I'd like to pick out just the "pencil" color in some drawings done by a young member of the household (he'd like to print out copies of these pictures and distribute them to his class mates on the last day of school, but has already colored them).
I tried Binarize
, which allows me to craft a color selection function, picking levels of each of Red, Green, or Blue. For example:
Clear[ girl, boy ] ;
boy = Import[ "http://imgur.com/mRRhOgo.jpg" ]
girl = Import[ "http://imgur.com/Q5ReXSX.jpg" ]
Binarize[ girl, #[[1]] > 0.8 & ]
Binarize[ girl, #[[2]] > 0.8 & ]
Binarize[ girl, #[[3]] > 0.8 & ]
The last works fairly well, but happens to leave a really dark section by the red belt. I figure it should be possible to code a color selection function that picks only things in the range of the gray pencil colored text, but I'd have to figure out what that color is first, and am not sure of a good approach to do that (other than sampling specific pixel values).
I'd imagine this problem could be solved by sorting the image points by color and picking the dominant ones. Then find the "gray colors" or ranges of those grays, and finally coding an image function selection for binarize to pick that color or range of colors. However, it's not clear to me exactly how to go about doing that.
EDIT: It looks like https://mathematica.stackexchange.com/a/5415/10 provides reasonable looking instructions on how to pick out just one color, so the problem may be reduced to just finding that "pencil" color. I've tried the Manipulate sliders in some of the other answers for that question, but find them very slow to update ( especially that of https://mathematica.stackexchange.com/a/5407/10 )
EDIT2: I see https://mathematica.stackexchange.com/a/4795/10 provides a locator based way of picking a color, which can probably be used to solve the find the "pencil" color part of the problem (although I'm still not sure how various darknesses of the pencil lines would be dealt with).
ColorSeparate[image, {c1, c2, ...}]
extracts the specified color components." Please, someone try this; if it works as I anticipate and it is given the proper primaries the result should be very good. $\endgroup$