does anybody know we can translate from real image captured using cameras be converted to the cartoon space ?
Please note that my goal is not to create animations or the likes, but just to translate to "cartoon colors" if possible.
will simple requantization to a space where there is less quantization levels work Or some other specific transforms are better ?
any help will be useful, as I wasn't able to find any material on this.
Thnx in advance.
Pyramid mean shift + outline of detected edges seems does the job.
The code:
cv::Mat segmented, gray, edges;
cv::pyrMeanShiftFiltering(input, segmented, 15, 40);
cv::cvtColor(segmented, gray);
cv::Canny(gray, edges, 150, 150);
cv::cvtColor(edges, edgesBgr, CV_GRAY2BGR);
cv::Mat result = bgr - edgesBgr;
Here is a result i got:
Details: OpenCV Tutorial Part 6
What you're trying to do is most commonly done from 3D models and is called cel-shading, or "toon-shading". Basically, you try to force uniform colors and force abrupt transitions at certain angles with respect to the light source.
Obviously, this does not translate well to 2D input images. What you can do, is to requantize but making sure you uniformly fill regions and break where the image gradient is high.
Non-linear diffusion is a denoising technique that forces regions to become uniform to remove noise. If you let it loop for too many iterations, you get a cartoon-looking image.
I've implemented that maybe 2-3 years ago and it worked suprisingly well considering it was not so hard to implement. However, you're going to want a GPGPU implementation because it is slow!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With