c# cartoon application miles lamensky. accepting demo pics [email protected] (
TRANSCRIPT
C# CARTOON APPLICATIONMiles Lamensky
Outline
• Definition and Requirements
• Solutions
• Methodology
• Real-Time Demo
• Exceptions
• Learning and Development Process
Definition and Requirements
Project: Develop an application that makes cartoon like images from pictures.
General Requirements: 1. Take an image and convert it to a cartoon like image using rotoscoping techniques.2. Implement save and open functions.3. Examine several rotoscoping algorithms and design your own.4. Control the contrast, tint and intensity of the cartoon.5. Choose a finite number of colors.6. Actually choose the specific colors. 7. Implement a mobile version.9. Consider showing the cartoon image as a preview before taking the picture.
Solutions
Solutions cont…
Methodology
• Image Format Conversation (Bitmap->Array, Bitmap->Image, etc.)
• Original Image -> Grayscale• Sobel (Damian Wegner, 2005: http://
compsci02.snc.edu/cs460/2005/wegndt/) • Palette Quantizer, Median Cut (Smart K8:
http://www.codeproject.com/Articles/66341/A-Simple-Yet-Quite-Powerful-Palette-Quantizer-in-C
)
Image targetImage = GetQuantizedImage(sourceImage);
Bitmap grayed = ToGrayscale(img); InitializeSolidBW(BWArray, grayed);
targetImage = Sobel_Process(targetImage);
Merge(SobelData, img);Sobel(SobelData, BWArray);
Real-Time Demo
Learning and Development Process
• Strategies• Extensions• Knowledge• Advice
Strategies
• Cursory/Playful Exploration
1
+ recursive sweeps+ averaging neighbors + color comparisonTHE BAD:+ timeeffectiveness
2 openCV+ Hough Transform
3 Sobel+ Working Edge Detection+ Noise Reduction Attempts (Median Cut)
4 Recursive Technique + SobelTHE BAD:+ too many colors+ still too much time
5 Color Quantization + Sobel
Exceptions
• Global Variables*• BIG Files*• Color Leakage• Thickening Detected Edges• Post-Edge Noise Reduction• Already Low-Quality Images
Color Leakage
Possible Fixes:• Edge Detection
First
+ Color mixing when too few colors
Thickening Detected EdgesPossible Fixes:• Alter Sobel Function
SobelData[y1, x1] = 255 - sum;
//FEEBLE ATTEMPT TO THICKEN EDGE; FAIL //SobelData[y1-1, x1-1] = 255 - sum; //SobelData[y1, x1 - 1] = 255 - sum; //SobelData[y1 - 1, x1] = 255 - sum; //SobelData[y1 + 1, x1 + 1] = 255 - sum; //SobelData[y1 + 1, x1] = 255 - sum; //SobelData[y1, x1 + 1] = 255 - sum; //SobelData[y1 + 1, x1 - 1] = 255 - sum; //SobelData[y1 - 1, x1 + 1] = 255 - sum;
Post-Edge Noise Reduction
Possible Fixes:• Noise Reduction Algorithms
Noise Reduction
Already Low-Quality Images
• The purpose of a color quantization!!!
Knowledge
• Android (-_-)• C# (*)• Color Comparison• RGB• openCV– Hough Transform
• Visual Basic– Sobel
• Color Quantization– Median Cut
For Future Friends
• Android• Real-Time Conversion (Video)
Advice
• Borrow Shamelessly (i.e. Steal Adapt)• Make a !@#$@ Plan• Read the Project Outline• Swallow Pride (i.e. ???’s)• Error Blog• Step Back– Alternate– Alcohol (if of age)
Hey. Thanks.