Image Filter art --- (Nostalgla Filter) old photo Filter,

Source: Internet
Author: User
Tags image filter

Image Filter art --- (Nostalgla Filter) old photo Filter,

Nostalgla Filter (Nostalgla Filter) The Nostalgla Filter is used to simulate a retro and outdated photo style, so as to display old photos in new photos. At present, there are many algorithms. This article introduces a new algorithm that is more realistic and more efficient: 1. Old photos generally have yellow paper features, we construct A dark-yellow floor layer A: RGB (200,120, 10); 2. The old photo also has crack characteristics. Of course, not all old photos do. Here we add crack features, the image is more vivid, so we can use PS to construct a crack template B, as shown in:

3. Perform grayscale processing on the original photo C to obtain the grayscale image D. here we can use the simplest grayscale formula: Gray = (R + G + B)/3; 4, perform the soft-light operation on D and A. See Figure E. The soft-light algorithm is as follows: int ModeSmoothLight (int basePixel, int mixPixel) {int res = 0; res = mixPixel> 128? (Int) (float) basePixel + (float) mixPixel-255.0f) * (Math. sqrt (float) basePixel/255.0f) * 255.0f-(float) basePixel)/255.0f): (int) (float) basePixel + (float) mixPixel + (float) mixPixel-255.0f) * (float) basePixel-(float) basePixel * (float) basePixel/255.0f)/255.0f); return Math. min (255, Math. max (0, res);} 5. Perform a soft operation on E and B to get the final F. The above is the implementation of the algorithm of the old photo filter, and the algorithm is relatively simple, but the results are quite good! The core code is as follows: private Bitmap NostalglaFilterProcess (Bitmap src, Bitmap mask) {Bitmap dst = new Bitmap (src); int w = dst. width; int h = dst. height; BitmapData maskData = mask. lockBits (new Rectangle (0, 0, w, h), ImageLockMode. readWrite, PixelFormat. format32bppArgb); BitmapData srcData = dst. lockBits (new Rectangle (0, 0, w, h), ImageLockMode. readWrite, PixelFormat. format32bppArgb); byte * p = (byte *) srcData. scan0; byte * pMask = (byte *) maskData. scan0; int offset = srcData. stride-w * 4; int B = 10, g = 130, r = 200, gray = 0; for (int j = 0; j

Source image

Old Photo Filter

Finally put a complete C # program DEMO: http://www.zealpixel.com/thread-69-1-1.html

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.