The Design and Implementation of the color ink effect in digital image processing effects, and the digital image processing ink
First, let's look at the two comparison images. First, the source image.
The following figure shows the effect after processing. In fact, it no longer looks like a picture taken, but more like a hand-drawn image.
In fact, in addition to the description of the edge, it is clear that the color also needs to be properly processed.
There should be room for improvement, but after all, the algorithm implementation method is very simple, and it reflects the basic idea to deal with such problems.
The following is the code I implemented using C ++ ON THE MAGICHOUSE platform.
Function call
SeaFun: InkSketch (our_image_buffer, temp_imageBuffer, X_image, Y_image );
For (int n = 0; n <sum; n + = 4)
{
Temp_imageBuffer [n] = temp_imageBuffer [n]> 0? Our_image_buffer [n]: temp_imageBuffer [n];
Temp_imageBuffer [n + 1] = temp_imageBuffer [n + 1]> 0? Our_image_buffer [n + 1]: temp_imageBuffer [n + 1];
Temp_imageBuffer [n + 2] = temp_imageBuffer [n + 2]> 0? Our_image_buffer [n + 2]: temp_imageBuffer [n + 2];
}
Implementation
Static void InkSketch (BYTE * image0, BYTE * image1, unsigned int w, unsigned int h)
{
BYTE ** imageBuf0 = CreatImage (image0, w, h );
BYTE ** imageBuf1 = CreatImage (image1, w, h );
Double scale = 2;
Int templt [25] = {
-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,
-1,-1, 30,-1,-1,
-1,-1,-1,-1,-1,
-1,-1,-5,-1,-1
};
Int x, y;
Int;
For (y = 2; y <H-2; y ++)
For (x = 2; x <W-2; x ++)
{
A = TempltExcute (imageBuf0, w, h, templt, 5, x, y );
A * = scale;
A = a> 255? 255:;
A = a <0? 0:;
SetPixel2 (imageBuf1, x, y, );
}
Free (imageBuf0 );
Free (imageBuf1 );
}