The Design and Implementation of the color ink effect in digital image processing effects, and the digital image processing ink

Source: Internet
Author: User

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 );
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.