I came to a similar conclusion, but it is more complicated than that.whugemann wrote:As with other options in ImageMagick, I think that the distortion operations could need some grouping, either by naming them more consequently or by introducing another "name layer".
I don't want to be able to just map to and from a plane surface, but would also like to map between the various types of projections. For example between a stereographic sphere representation, and a orthographic sphere, plane, cylinder, mercator cylinder, etc etc etc.
As such the latest distortion was named cylinder2plane and plane2cylinder.
However to make this work I don't want to work out all the formulas between each projection.
As such I want to be smarter about this, and generate a mapping to/from each 'projection' to a common vector.
This may as you mentioned require a special 'distort' operator, that defines the two projections as separate entities.
-distort-projection cylinder 'args' plane 'args'
the cylinder args may include the image width FOV, and center of distortion. The Plane args however may include center of distortion, and a distance from center, or more FOV angles. This is actually more like distorting the image coordinates twice.
ASIDE: derivatives in this style is NOT really needed as I would simply map other points in the neighbourhood to figure out the scaling vectors needed.
However this type of change I am loathed to even start, as it means a major re-organization of distort function into a more functional form. It is also something that is needed to allow 'any-quad to any-quad bilinear distortions' and then to the use of sub-area distortions such as triangular or grid mesh distortions. As such It needs to be done any way, just to allow distortions to become more useful. (the next level of abstraction)
This is a large task and is in someways a complete re-organization of the distortion module, the more I think about it, the more I am loathed to start. I am thinking this type of change may need to be part of IMv7 beta development.
Note this does not mean I am unwilling to implement specific distortions like cylinder2plane, when I have complete details for the implementation. However I would like Wolfgang's input on what extra arguments should be added to the current cylinder2plane distortion (as it stands without further Y distortions), so I can finish this addition.