I would just like to ask for assistance to anyone on the logic, and much better sample code of formulating an image\'s outline.
To make it clearer, I\'m talking abo
One way is to use a general edge detection algorithm. For example, Sobel edge detection. However, it's not optimized for clean, antialiased, two-color images like the example below, so it produces a somewhat rough result. To better preserve the antialiasing, and get a smooth result, I suggest the following algorithm:
Image blurredImg = gaussianBlur(sourceImg, blurRadius = desiredOutlineWidth);
const float sharpnessCoef = 0.1; // value may need tuning or may need to
// depend on the blur radius
Image dilatedImg = from blurredImg, map all pixels with
brightness > sharpnessCoef to white and
multiply the rest by 1 / sharpnessCoef
Image smoothResult = subtract sourceImg from dilatedImg
Example:
Consider using image processing techniques, like this one:
http://www.codeproject.com/KB/cs/Canny_Edge_Detection.aspx