Page 1 of 1

Circle to Square transformation?

Posted: 2014-09-30T08:40:50-07:00
by josephs
Hi everyone.

Any ideas how to go about converting a circle to square? I am looking for something like this https://www.flickr.com/photos/sbprzd/362529354/
My example was accomplished in MathMap. Maybe ImageMagick isn't ideal for this sort of thing but I would like to give it a shot. Basically the source image would be square and the circle bounded by the square would be mapped to the square.

I appreciate any help!

Joseph

Re: Circle to Square transformation?

Posted: 2014-09-30T10:13:57-07:00
by snibgo
I would do it with an "-fx" expression. Within that expression, for the current pixel, calculate the distance from the centre, and the angle from the vertical. From these two, calculate the polar distance for the source pixel for this current pixel. The polar angle is the same. Thus you have the (x,y) of the source pixel.

Perhaps this is very similar to your MathMap operation.

Re: Circle to Square transformation?

Posted: 2014-09-30T10:47:49-07:00
by josephs
Thanks Snibgo...I'm going to get started on this!

Re: Circle to Square transformation?

Posted: 2014-10-02T00:06:06-07:00
by snibgo
"-auto-level" would be good for this. See http://imagemagick.org/script/command-l ... auto-level

Or perhaps "-evaluate Multiply 10", or some other number.