Page 2 of 2
Re: Perspective + Shepards -- feature request
Posted: 2014-07-20T21:36:54-07:00
by Marcin
Thanks. Mesh warp looks like something worth trying out. But again, to make it work, I'll need to know the position of control points after the perspective distortion.
My program can draw a map of any fragment of the sky in any rotation. First, it calculates the positions of stars after a spherical projection, then it uses the positions of some stars as target control points in perspective distortions of constellation images. If a perspective distortion has more than four control points, I don't know their target positions without knowing the coeffcients of the distortion.
Re: Perspective + Shepards -- feature request
Posted: 2014-07-20T22:21:25-07:00
by Marcin
Marcin wrote:
Thanks. Mesh warp looks like something worth trying out. But again, to make it work, I'll need to know the position of control points after the perspective distortion.
Stupid me. I can do mesh warp directly from source to target, without the intermediate perspective distortion. I'll try that.
Re: Perspective + Shepards -- feature request
Posted: 2014-07-21T00:11:16-07:00
by anthony
Even if you only apply the mesh warp to a X and Y gradient image and smooth it with a blur, before using that on the image, as a Absolute Distortion Map.
http://www.imagemagick.org/Usage/mappin ... rtion_maps
Note: there is a builtin compse method ("distort" I think) to apply Absolute Distortion Maps, I just never made the examples of using it.
Re: Perspective + Shepards -- feature request
Posted: 2014-07-21T10:55:21-07:00
by Marcin
Marcin wrote:Stupid me. I can do mesh warp directly from source to target, without the intermediate perspective distortion. I'll try that.
I was wrong again. As I understand it, to use mesh warp, I have to know the target coordinates of the corners of the image or at least of the points on the boundary of some set containing it. My stars (points whose target positions I know) lie within the constellation images. Back to square one.
To recap: PerspectiveDistortion computes its coefficients and can print them to stderr but then forgets them and does not provide a way to retrieve them via MagickWand. This thread boils down to a design question: is MagickWand a first-class citizen of ImageMagick that is supposed to provide feature parity with the command-line tools? This is an honest question. I can accept either answer without whining.
Re: Perspective + Shepards -- feature request
Posted: 2014-07-21T11:19:34-07:00
by fmw42
I cannot answer your last question. I do not know about MagickWand, but in command line, you can get the fx equivalent forward and inverse coefficients and then you can use those to project any other points you want either direction and compare them, if that helps.
Re: Perspective + Shepards -- feature request
Posted: 2014-07-21T20:04:54-07:00
by anthony
The output was originally added as a way of double checking what the distort was doing.
It may be posible to save that information in various attributes, but then that sort of thinking is more IMv7 style, where command line processing was being converted more into a internally parsed scripted processing technique, thus saving more information as image meta-data for later re-use.
Simple examples (more as a proof of concept) are available in IMv7 source, in the "api_examples" sub-directory, I hopes other API languages would also add similar examples.
CLI processing is actually very Wand like in many respects, and has always been closely related, and IMv7, makes it more so, to such an extent that you could mix call systems! It works by having a structure, MagickCLI, to hold not only a Wand, (list of images and meta-data), but also the special structures needed such as DrawInfo, and QuantizeInfo, that may also be applied to the images.
As such CLI processing API are layered wrappers....
CLI -> MagickCLI -> MagickWand/DrawInfo -> MagickCore
Basically what I am saying is the IM CLI is moving in a direction that would allow more MagickWand interaction, or indeed, interaction at mutliple API levels, as that is why it was created.