Page 1 of 1
Find sub-image position in main-image
Posted: 2013-09-25T22:48:00-07:00
by selvam
Hi,
I'am new to ImageMagick.
working on OMR(Optical mark recognition) have two images
1. main-image(tiff)
2. sub-image(tiff)
need to identify the position(x, y) of the sub-image in the main-image.
Need to do it c or c++.
Thanks for any input.
Selvam
Re: Find sub-image position in main-image
Posted: 2013-09-26T09:36:03-07:00
by fmw42
Re: Find sub-image position in main-image
Posted: 2013-09-27T04:55:11-07:00
by selvam
Thanks for your valuable inputs.
I have gone through the "compare"(Command line Program) with the -subimage-search option.
but I'am not able to find an equivalent function in c or c++.
The "compare"(Command line Program) returns the best match offset
ie.(Returns Only one best matched Offset Value among the several offset values)
The Following are my requirements :
1 ) All the occurrence of the marker(sub-image) positions in the scanned(main-image) image, must be identified.
2 ) Based on all the occurrence, we need to do Cropping work on the scanned(main-image) image
Thanks in advance
Selvam
Re: Find sub-image position in main-image
Posted: 2013-09-27T09:47:16-07:00
by fmw42
The Following are my requirements :
1 ) All the occurrence of the marker(sub-image) positions in the scanned(main-image) image, must be identified.
2 ) Based on all the occurrence, we need to do Cropping work on the scanned(main-image) image
The second output image (result-1) will be the match score image. You can search that for all the best matches.
see my script, maxima, at the link below for ideas how to do that.
Re: Find sub-image position in main-image
Posted: 2016-03-09T06:20:23-07:00
by oxspray
Hello fmw42,
Thanks for your script (maxima).
I also need to extract all subimages positions found in a reference main image.
The main image is a map with different icons (like POI). Sometimes there is several same icons inside the map.
My problem is I don't know how to pass the subimage as parameter in the maxima command or how to use parameters correctly.
Is the maxima script adapted to my request? If yes how can I use it properly?
Thanks!
Re: Find sub-image position in main-image
Posted: 2016-03-09T09:24:10-07:00
by fmw42
My maxima script will find as many matches as you desire or stop when the match score gets too low. It returns each one. The key is to provide the mask region size. The script finds the highest correlation value and its coordinates. Then it masks out that location, Then repeats for the next highest correlation value, etc. Read the documentation about the arguments on the examples page for maxima.