coordinates of two images
coordinates of two images
Hi,I need to find the coordinates of two images to find the differences between them to see if they shift or not.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: coordinates of two images
Please clarify in more detail what you are trying to do? Do you want the coordinates of every pixel that are different between two same size images? Or are you trying to find the best match of a smaller image where it matches best inside a larger image?
For the latter, see
compare -metric rmse -subimage-search largeimage smallimage resultimages
where resultimages will be either two image -0 and -1 or two frames (but you only specify the name), depending upon format. The second image will be the match score result and the brightest pixel will be the location of the best match. The best match will also be returned as text to the terminal.
see example at viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076 but note that since then the -subimage-search needs to be added to the command
For the former, see http://www.imagemagick.org/Usage/compare/
Once you get the red/white image or black/white image (see examples above), you can convert that image to txt format to get all the say red value coordinates. see http://www.imagemagick.org/Usage/files/#txt
convert red_white_image txt:- | grep "red"
For the latter, see
compare -metric rmse -subimage-search largeimage smallimage resultimages
where resultimages will be either two image -0 and -1 or two frames (but you only specify the name), depending upon format. The second image will be the match score result and the brightest pixel will be the location of the best match. The best match will also be returned as text to the terminal.
see example at viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076 but note that since then the -subimage-search needs to be added to the command
For the former, see http://www.imagemagick.org/Usage/compare/
Once you get the red/white image or black/white image (see examples above), you can convert that image to txt format to get all the say red value coordinates. see http://www.imagemagick.org/Usage/files/#txt
convert red_white_image txt:- | grep "red"
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: coordinates of two images
This may not work with a normal "compare" image result. The color is not pure red, but a red tint of one of the images.fmw42 wrote:convert red_white_image txt:- | grep "red"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: coordinates of two images
I understand. That is why I specifically pointed to your processing to extract the binary mask as either red/white or black/white.anthony wrote:This may not work with a normal "compare" image result. The color is not pure red, but a red tint of one of the images.fmw42 wrote:convert red_white_image txt:- | grep "red"
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: coordinates of two images
Fair enough...
I just wanted to point out the 'normal' compare is not pure red-white or black-white, as it did not seem clear.
I just wanted to point out the 'normal' compare is not pure red-white or black-white, as it did not seem clear.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: coordinates of two images
anthony wrote:Fair enough...
I just wanted to point out the 'normal' compare is not pure red-white or black-white, as it did not seem clear.
OK. Thanks. Fair enough.
Re: coordinates of two images
I want the coordinates of every pixel that are different between two same size images.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: coordinates of two images
adelina wrote:I want the coordinates of every pixel that are different between two same size images.
see
http://www.imagemagick.org/Usage/compare/#difference
http://www.imagemagick.org/Usage/files/#txt
Example:
convert cyclops.png cyclops3.png \
-compose difference -composite \
-colorspace gray -threshold 0 \
txt:- | grep "white"
49,49: (255,255,255) #FFFFFF white
50,49: (255,255,255) #FFFFFF white
51,49: (255,255,255) #FFFFFF white
49,50: (255,255,255) #FFFFFF white
50,50: (255,255,255) #FFFFFF white
51,50: (255,255,255) #FFFFFF white
49,51: (255,255,255) #FFFFFF white
50,51: (255,255,255) #FFFFFF white
51,51: (255,255,255) #FFFFFF white