将图像转换成OpenCV的彩色铅笔素描 [英] convert an image into color pencil sketch in OpenCV
问题描述
我想将图像转换为使用OpenCV的彩色铅笔素描。我已阅读页面<一个href=\"http://stackoverflow.com/questions/5675151/i-want-to-convert-an-image-into-pencil-sketch-in-opencv\">I希望将图像转换成OpenCV的素描
即我谋.The效果就像 http://www.showandtell-graphics.com/photosketch.html
我使用的颜色躲闪code
I want to convert an image to a color pencil sketch using OpenCV. And I have read the page I want to convert an image into pencil sketch in OpenCV .The effect which I seek is like http://www.showandtell-graphics.com/photosketch.html I used the color dodge by code
b_d = (b_2==255? 255: min(255, b_1*255 /(255- b_2)));
g_d = (g_2==255? 255: min(255, g_1 *255/(255- g_2)));
r_d = (r_2 ==255? 255: min(255, r_1 *255/(255- r_2)));
看来工作不是很顺利。
请帮助。
It seems work not very well. PLS help.
推荐答案
整体过程在你给我们的链接详细的,所以你需要3图像来达到这种效果。
The overall procedure is detailed in the link you gave us, so you need 3 images to achieve this effect.
请与原始图像的副本,并将其转换为灰度。
Make a copy of the original image and convert it to grayscale.
请灰度图像的副本和反转这个形象。
Make a copy of the grayscale image and invert this image.
在这一点上,<strong>图片#1 与原来的图片#2 是灰度和图片#3 与倒影。
At this point, image #1 is the original, image #2 is grayscale, and image #3 is the inverted image.
然后,应用的 颜色减淡 的图像#3 (使它白)和<一个href=\"http://opencv.itseez.com/modules/imgproc/doc/filtering.html?highlight=gaussianblur#gaussianblur\">execute模糊。单单这会给你在灰度铅笔素描效果。
Then, apply the color dodge to image #3 (making it white) and execute the blur. This alone will give you the pencil sketch effect in grayscale.
如果你想最终的结果是彩色的,你将不得不混合图像#3图像#1。
If you want the final result to be colored, you will have to blend image #3 with image #1.
Looking for information on blending? Check this, this and this.
这篇关于将图像转换成OpenCV的彩色铅笔素描的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!