Image Filter art-squeeze filter, filter Pinch

Source: Internet
Author: User
Tags image filter

Image Filter art-squeeze filter, filter Pinch

Pinch filter the Pinch filter uses Coordinate Transformation to achieve the effect of squeezing and deformation from an image within a certain radius of R at the center of a certain point (cenX, cenY. There are many algorithms to implement this filter, mainly because of the differences in mathematical formulas. You can design it yourself. Here is a sample code that you can use directly. The Code is as follows: // <summary> // Pinch Filter // </summary> // <param name = "src"> Source image. </param> /// <param name = "cenX"> The X position of sun. </param> // <param name = "cenY"> The Y position of sun. </param> // <returns> The result image. </returns> private Bitmap PinchFilterProcess (Bitmap srcBitmap, int cenX, int cenY) {Bitmap a = new Bitmap (srcBitmap); int w =. width; int h =. height; int radius = 0; Bitmap dst = new Bitmap (w, h); System. drawing. imaging. bitmapData srcData =. lockBits (new Rectangle (0, 0, w, h), System. drawing. imaging. imageLockMode. readWrite, System. drawing. imaging. pixelFormat. format32bppArgb); System. drawing. imaging. bitmapData dstData = dst. lockBits (new Rectangle (0, 0, w, h), System. drawing. imaging. imageLockMode. readWrite, System. drawing. imaging. pixelFormat. format32bppArgb); unsafe {byte * pIn = (byte *) srcData. scan0.ToPointer (); byte * pOut = (byte *) dstData. scan0.ToPointer (); byte * p = null; int sWidth = srcData. stride; int stride = sWidth-w * 4; int offsetX = 0, offsetY = 0; int newX = 0, newY = 0; double radian = 0, degree = 10; for (int y = 0; y :

Source image

Pinch Filter

Finally put a complete C # version of the program Demo for everyone to download the use of: http://www.zealpixel.com/forum.php? Mod = viewthread & tid = 55 & extra = page % 3D1

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.