Mobile app version of vmapp.org
Login or Join
Pierce403

: What's the best way to reproduce a Captcha distortion? What would be the simplest way to distort a text (or image) as in the captchas we see online. Formerly I would model a wavy 3D surface,

@Pierce403

Posted in: #Typography

What would be the simplest way to distort a text (or image) as in the captchas we see online. Formerly I would model a wavy 3D surface, apply the text/image as a texture and render it. There must be a better way ...

captchas icp.ge.ch/sem/cms-spip/IMG/png/captcha-2.png

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce403

3 Comments

Sorted by latest first Latest Oldest Best

 

@Vandalay110

From a pure technical standpoint distortion is very easy to do. To understand this you have to realize that the image is a matrix stacked onto your screen. If we need to refer to a specific pixel its easiest to think of this pixel as having a coordinate in both x and y within the image filed. To visualize this let use normalize the coordinates to 0-1 range this makes it convenient to use as you can now view the data in the imaging application.

But what happens if this coordinate field is not even? The image then distorts. There are many tools that can do this because its a very basic operation at the look up level. 3D imaging applications can do this on a texture level as well as object distortion level. Nearly all imaging tools have this function, because its important if you want to use your image as data or manipulate pixels movement in any way (so without this tool you can not rotate images non 90 degree increments for example). A partial (really just a fraction) list of that I have used to induce distortion include: Photoshop, GIMP, ImageMagick, Aftereffects, Shake, Nuke, Fusion, Maya , 3DS Max, Blender, Mathematica.... Off course this is also pretty easy to program yourself. However, if you need to do this in a automated fashion look into using ImageMagic (see following technical explanation for a more thorough explanation on the subject).

But let us use a alternate approach for Photoshop (with no painting involved):



Image 1: Original image

To distort the original image let us make a new image with the dimensions of the original divided 10 (or something like that). fill image with 50% gray and apply some Gaussian noise (maybe 25-50% noise). Scale the image up to the size of the original image. Save this image out as vector field.png or something. Back in the original image choose filter -> distort -> displace.., set the scales to something like 1-2, point it to the random noise you made. Now this is one way you could also use less pixels or stack 2 different sized pixel images on top of each other etc... Basically this is what the liquify does it makes a vector field.



Image 2: Vector field used for distortion



Image 3: result after the steps above have been completed.

Each time you do this the result is different. You can also do this with the Puppet warp tool in Photoshop and after effects for example.

It is also possible to do this for vector data itself. For example in Illustrator you could use Object -> Envelope Distort -> Make with mesh... But this is all i have time for, gotta go and do something else.

10% popularity Vote Up Vote Down


 

@Karen819

Not sure how many words your want to distort, but if it's not too many you could just use the Liquify tool in Photoshop.

Filter > Liquify


Then with the brush just push the text about until you're happy with it.

You will have to raster the text for it to work.

10% popularity Vote Up Vote Down


 

@Smith574

You basically need some mapping from the plain image P to the CAPTCHA image C that should have some nonlinear distortion, but, from the math side, be continuous, and "relatively harmless".

So I propose to not bother to use a strict model for the distortion, but start with a simple identity mapping the points Pij to Cij.
If you don't map actual pixels, but points spaced about 15 image pixels or so,
you can then "push around" these points by things like adding small random values to the Cij.

To create an actual pixel mapping from that, you could use some kind of rubber sheet interpolation. (Or any interpolation creating bad artifacts, which makes your CAPTCHA actually better)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme