ScaleRotateTranslateDistortion in 6.3.5-5

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

ScaleRotateTranslateDistortion in 6.3.5-5

Post by rmagick »

Anthony,

I'm testing the RMagick interface to DistortImage and I noticed that the ScaleRotateTranslateDistortion can return a NULL image without setting any error fields in the ExceptionInfo argument. Is this intentional or just a product of DistortImage being a work-in-progress?

I'm looking at 6.3.5-5:

Version: ImageMagick 6.3.5 08/03/07 Q16 http://www.imagemagick.org
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ScaleRotateTranslateDistortion in 6.3.5-5

Post by magick »

The current beta release has improved exception reporting.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

General Distortion in 6.3.5-5

Post by anthony »

The whole set of routines are under development, and in fact the interface changed slightly. Nothing is completely settled with this function as yet.

Actually a lot of extra exception handling is needed, as well as a lot more distortion methods, and even some low level 'out of band' options that are normally not needed, are yet to be handled.

In fact any views you may have on this function... NO is a good time to express them before things become set in stone.

Currently I am on a hold, as I research things such as resize filters, areas sampling, super and adaptive sampling, and Elliptically Weighted Average sampling functions are looked at in an attempt to enhance the 'minification' aliasing that is occuring in extreme distortions. For example the center of a very strong 'implosion' or toward the vanishing points of a extreme perspective distortion.

Suggestions are most welcome.


In any case how is your testing going? And findings or problems?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: ScaleRotateTranslateDistortion in 6.3.5-5

Post by rmagick »

Hi, Anthony! The latest release seems to be working fine.

I'm not testing the distortions themselves - I leave that up to you guys. All I'm doing (indeed, all I do for all of the ImageMagick APIs) is check to make sure that the RMagick method accepts the right number and type of arguments, returns the right kind of object, and handles errors properly. It was my test for error handling that caught the missing ExceptionInfo data. Occasionally one of my example scripts uncovers a problem, but it's not because I'm deliberately testing ImageMagick.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ScaleRotateTranslateDistortion in 6.3.5-5

Post by anthony »

Did you pick up on the extra boolean that was added to the interface?

This boolean will turn on 'bestfit' where the output image size and virtual offset will
be adjusted to hold the complete distortion input image. (no clipping). A bit like what Arc distort will always do. It also turns on the input image virtual offsets.

This boolean is mapped to the -/+ aspect of the command line API option, so -distort generally uses the same size as the input image while +distort 'bestfits' the result to the distorted image.

Other options may be added but using special settings. for example
a output 'scaling' or posibly 'super-sampling'. Development is in progress.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: ScaleRotateTranslateDistortion in 6.3.5-5

Post by rmagick »

Thanks for pointing this out, Anthony. I take a day off and the whole API changes :-) I'll update RMagick so it can compile w/o errors with the new DistortImage signature and release an updated beta.

I notice that DistortImage is back to returning a NULL without setting any ExceptionInfo fields when an error occurs, though.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ScaleRotateTranslateDistortion in 6.3.5-5

Post by anthony »

The NULL means a new image was not generated, For the command line it means the input source image should not be replaced, what other API's should do is unknown. Exceptions are still to be added, to the interface.

Warning, do not expect the number of argument in Affine, Perspective, and Bilinear to be fixed. IN photomosaics (creating panarama images from multiple photos) they often use a least squraes fitting of the distortion to multiple control points beyond the minimum 3 or 4 control points needed. In fact it may be that the number of input control points could be in the order of 20 to 100 points!

Also we may even allow the use of proper rubber-sheeting and control point morphing to create true image morphing between images.

These distort functions is opening up a whole range of very very advanced image processing options, not posible to implement with out it. Of course most of this is on ToDO lists, but help could be appreciated in developing applications using the new functions.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rmagick
Posts: 245
Joined: 2006-03-16T17:30:48-07:00
Location: Durham, NC, USA

Re: ScaleRotateTranslateDistortion in 6.3.5-5

Post by rmagick »

Gotcha. When the API is a little more "cooked" I'm thinking about doing some kind of "Cover Flow" demo in RMagick. That should get a little attention.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ScaleRotateTranslateDistortion in 6.3.5-5

Post by anthony »

If it makes you feel any better, the PerlMagick API interface for Distort is still showing the initial first draft of the function call, and the 'best-fit' flag is hardcorded to false until someone gets around to looking at it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply