I am buissy adding IM functions to my software and am working on Distort now, I am using the IM Core interface.
I tried putting random values in a Perspective Projection Distortion and sometimes I had a crash and sometimes no results at all.
I found that the crash was caused by using -ve values for Px or Py, you can see why if you inspect the equations given on the examples page, division by zero.
I also noticed that the 'shrinking' can only be done in one direction along each axis, so I have decided to make -ve values of Px,Py flip/flop the sourcxe image then flip/flop it back again when the distortion is done, and use abs(Px) and abs(Py) for the distort paramaters.
I noticed that it is easy to Distort an image away, are there any easy sanity checks on values to warn of this or when a distort is impossible?
Alan Hadley
Perspective Projection Distortion
-
- Posts: 48
- Joined: 2010-03-31T12:17:55-07:00
- Authentication code: 8675308
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Perspective Projection Distortion
Distort perspective is impossible if the divisor is zero or if you put a twist into your coordinates (the top right is left of the top left, same for bottom, but only one or the other top or bottom swapped) or if all points fall on a line.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Perspective Projection Distortion
When putting a twist in the perspective distort, the 'sky' or 'missed image' aspect of perspective distortion may suddenly decide you are looking from 'underneath' the distortion, as make it 'disappear' (use 'matte color' instead).
It was added to make it easy to do 'horizon' views, relativeally easy to generate.
See Viewing Distant Horizons
http://www.imagemagick.org/Usage/distorts/#horizon
It was added to make it easy to do 'horizon' views, relativeally easy to generate.
See Viewing Distant Horizons
http://www.imagemagick.org/Usage/distorts/#horizon
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/