Page 1 of 1

Stitch two images togather using Fudicial Point in Image Magick

Posted: 2017-08-16T14:37:12-07:00
by bhim.rathor
Hi,

I would appreciate if someone can please let me know how to stitch or merge 2 images together based of a reference point or region on each images so that a new image is joined by overlapping or superimposing point or region from each image. This is something like page 10-12 of below document

https://estore.merge.com/na/resources/a ... _guide.pdf

Thanks
Bhim

Re: Stitch two images togather using Fudicial Point in Image Magick

Posted: 2017-08-16T15:08:42-07:00
by fmw42
I am not sure I understand your question nor the how it relates to the diagram in your link. But as a guess I would assume it is a -distort Affine. See http://www.imagemagick.org/Usage/distorts/#affine or -distort Perspective. See http://www.imagemagick.org/Usage/distorts/#perspective

Please, always provide your IM version and platform when asking questions, since syntax may differ.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620http://http://w ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/

Re: Stitch two images togather using Fudicial Point in Image Magick

Posted: 2017-08-16T16:06:32-07:00
by bhim.rathor
Thanks for the response.

To make my question more clear i have added specific examples below at

https://drive.google.com/drive/folders/ ... sp=sharing.

Each of these shows the 2 input images and 1 output image by following methods

StitchingBySinglePoint
StitchingByTwoPoints
StitchingByLine
StitchingByTwoLines

Also I was not sure what IM version should i use but i am open to any as long as i find a solution. I am on windows platform.

Hope its clear now and will find a solution to this.

Thanks
Bhim

Re: Stitch two images togather using Fudicial Point in Image Magick

Posted: 2017-08-16T16:26:29-07:00
by snibgo
I assume your lines are always straight lines, so only the end points matter.

I'll take the two-line case. This has four points, two on each image. You want to distort one image so that its two points align with the two points on the other image. Is that correct?

Suppose the points on one image (image1.png) are (X1,Y1) and (X2,Y2). The points on the other image (image2.png) are (X3,Y3) and (X4,Y4). X1, Y1 etc must be actual numbers, perhaps floating-point.

For IM v6, Windows BAT syntax:

Code: Select all

convert ^
  image1.png ^
  +distort affine "X1,Y1,X3,Y3 X2,Y2,X4,Y4" ^
  image2.png ^
  -compose Over composite ^
  images_out.png
For IM v7, use "magick" instead of "convert".

If you have only one point on each image, use:

Code: Select all

  +distort affine "X1,Y1,X2,Y2" ^
You can do fancy things like making the top image semi-transparent, and so on.

Re: Stitch two images togather using Fudicial Point in Image Magick

Posted: 2017-08-16T16:30:41-07:00
by bhim.rathor
Thanks You. Let me try this and come back. Hope this will resolve my issue.

Thanks Again.

Bhim