File

advertisement
C# CARTOON APPLICATION
Miles Lamensky
Accepting Demo Pics
miles.lamensky@snc.edu
( <600x400 )
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
targetImage =
Sobel_Process(targetImage);
Image targetImage
=
GetQuantizedImage
(sourceImage);
Sobel(SobelData, BWArray);
Bitmap grayed =
ToGrayscale(img);
InitializeSolidBW(BWArray,
grayed);
Merge(SobelData, img);
Real-Time Demo
Learning and Development
Process
•
•
•
•
Strategies
Extensions
Knowledge
Advice
Strategies
• Cursory/Playful Exploration
1
+ recursive
sweeps
+ averaging
neighbors
+ color
comparison
THE BAD:
+ time
effectiveness
2
openCV
+ Hough
Transform
3
Sobel
+ Working Edge
Detection
+ Noise Reduction
Attempts (Median
Cut)
4
Recursive
Technique + Sobel
THE 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
+ Color mixing when too few colors
Possible Fixes:
• Edge Detection
First
Thickening Detected Edges
Possible 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.
Download