Reputation: 1576
Greetings,
Can anybody tells how can I give image distortion effect to images like pinch, twirl, bathroom, punch, cylinder etc . Actually I am making a small image library for photo editing.
I tried Google it bit couldn't find much help.
If anybody can help or suggest me image distortion algorithm, I will be thankful.
Thank You!!
Upvotes: 3
Views: 2802
Reputation: 1756
I personally don't know how to implement these effects, exactly, but you could look at Gimp, which is open source, and pull out what you need (respecting their license, of course). In general, these kinds of image effects simply transforms from one set of coordinates to another. So, for each pixel position in the dest image, run it through a transform that maps to a different coordinate, sample from the source image, and output the pixel to the dest.
If you want to do this realtime, one technique you could use is to texture map the image onto a high resolution grid mesh. For the twirl effect can be done by rotating vertices around a centerpoint, with an angle that is inversely proportional to the distance from the centerpoint. In fact, this is great for a wide variety of effects. You can achieve this with OpenGL, or XNA if you're on a non-OpenGL Microsoft platform.
Upvotes: 1