gmic deform - how is it done?


(Alexandre Cunha) #1

Hello

I am using the -deform command in gmic to obtain random perturbations of a given closed contour - in fact, just a circle - and I would like to know a bit more about its randomness and how the deformation is actually performed according to a given ‘amplitude’ value. It works pretty well. Any documentation I can read about it?

gmic circle.ct.pgm -deform 30 -neq 0 -flood 0,0,0,0,0,1,255 -negate -pink border,8 -normalize 0,255 -o deformed.pgm

Thanks,

  • Alex

(G'MIC staff) #2

deform is a very small command, and the main code looks like this :

    2%,2%,1,2 noise. $1 r. ..,..,1,2,5 warp.. .,1,$2,1 rm.

it is basically just a small noise image bicubic-ly interpolated to the input image size, that serves as a warping field.


(Alexandre Cunha) #3

Thanks for the information. Very simple and clever way to deform randomly.


(dumb) #4

There is another variation of the same command. ‘Crease’ uses a more granular matrix image and a linear interpolation for the warping field.