How to do Perspective Projection Distortion ?
Posted: 2013-05-06T15:02:16-07:00
Hi,
I have Perlmagick / Imagemagick 6.7.7.10-5 installed on my Raspberry Pi.
I want to do a perspective projection distortion, basically taking the upper two points of the image and shift them out on x-axis further left (-15) and right (+8).
I understood from the docu ( http://www.imagemagick.org/Usage/distorts/ ) that there are two ways to do this, either providing the coordinates for the 4 points and use distort perspective method or use the Perspective Projection Distortion and providing the matrix coefficents. I tried both methods on http://www.imagemagick.org/MagickStudio ... Studio.cgi and it works as it should with following parameters:
distort perspective with params: 0,0, -15,0, 0,59, 0,59, 281,59, 281,59, 281,0, 287,0 or
distort perspective projection with params: 1.06649, 0.25, -15 0, 1.06649, 0 0, 0.00111
Now the problems: perspective projection distort seems to be not existing in PerlMagick, at least it is not mentioned in the API description. Or is this a version problem and it was not there in 6.7.7 ? If it is existing undocumented in PerlMagick, what is the syntax to use it ?
When I try to do the normal perspective distort with the points it does not work either:
$image2->Distort('virtual-pixel'=>'transparent', type=>'Perspective', points=>[0,0,-15,0,0,59,0,59,281,59,281,59,281,0,287,0]);
perl: magick/distort.c:498: GenerateCoefficients: Assertion `! "Unknown Method Given"' failed.
Aborted
Any hints ?
Thank you
Best Regards
kehlh
I have Perlmagick / Imagemagick 6.7.7.10-5 installed on my Raspberry Pi.
I want to do a perspective projection distortion, basically taking the upper two points of the image and shift them out on x-axis further left (-15) and right (+8).
I understood from the docu ( http://www.imagemagick.org/Usage/distorts/ ) that there are two ways to do this, either providing the coordinates for the 4 points and use distort perspective method or use the Perspective Projection Distortion and providing the matrix coefficents. I tried both methods on http://www.imagemagick.org/MagickStudio ... Studio.cgi and it works as it should with following parameters:
distort perspective with params: 0,0, -15,0, 0,59, 0,59, 281,59, 281,59, 281,0, 287,0 or
distort perspective projection with params: 1.06649, 0.25, -15 0, 1.06649, 0 0, 0.00111
Now the problems: perspective projection distort seems to be not existing in PerlMagick, at least it is not mentioned in the API description. Or is this a version problem and it was not there in 6.7.7 ? If it is existing undocumented in PerlMagick, what is the syntax to use it ?
When I try to do the normal perspective distort with the points it does not work either:
$image2->Distort('virtual-pixel'=>'transparent', type=>'Perspective', points=>[0,0,-15,0,0,59,0,59,281,59,281,59,281,0,287,0]);
perl: magick/distort.c:498: GenerateCoefficients: Assertion `! "Unknown Method Given"' failed.
Aborted
Any hints ?
Thank you
Best Regards
kehlh