Stitch two images togather using Fudicial Point in Image Magick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
bhim.rathor
Posts: 21
Joined: 2016-02-21T13:47:15-07:00
Authentication code: 1151

Stitch two images togather using Fudicial Point in Image Magick

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

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

Post 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/
bhim.rathor
Posts: 21
Joined: 2016-02-21T13:47:15-07:00
Authentication code: 1151

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
bhim.rathor
Posts: 21
Joined: 2016-02-21T13:47:15-07:00
Authentication code: 1151

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

Post by bhim.rathor »

Thanks You. Let me try this and come back. Hope this will resolve my issue.

Thanks Again.

Bhim
Post Reply