Perspective + Shepards -- feature request

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Marcin
Posts: 9
Joined: 2014-07-18T04:35:18-07:00
Authentication code: 6789

Re: Perspective + Shepards -- feature request

Post by Marcin »

fmw42 wrote:I do not know if this will help, but you could do a mesh warp. see my script at http://www.fmwconcepts.com/imagemagick/ ... /index.php for an example.
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.
Last edited by Marcin on 2014-07-20T22:25:23-07:00, edited 1 time in total.
Marcin
Posts: 9
Joined: 2014-07-18T04:35:18-07:00
Authentication code: 6789

Re: Perspective + Shepards -- feature request

Post by Marcin »

Marcin wrote:
fmw42 wrote:I do not know if this will help, but you could do a mesh warp. see my script at http://www.fmwconcepts.com/imagemagick/ ... /index.php for an example.
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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Perspective + Shepards -- feature request

Post by anthony »

fmw42 wrote:I do not know if this will help, but you could do a mesh warp. see my script at http://www.fmwconcepts.com/imagemagick/ ... /index.php for an example.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Marcin
Posts: 9
Joined: 2014-07-18T04:35:18-07:00
Authentication code: 6789

Re: Perspective + Shepards -- feature request

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Perspective + Shepards -- feature request

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Perspective + Shepards -- feature request

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply