Page 1 of 1

Search for mutual/common overlay on many photos

Posted: 2012-02-28T20:51:23-07:00
by elmuSSo
Hello guys. I would like to politely ask You if there is a way in ImageMagick to:

1. Analyse two or more photos/pictures to find the common part? There is exactly the same overlay/stamp on each image, and it is in the same place, and images are the same size. So after taking eg. 100 pictures and analysing them, program should get the ideal picture of the overlay alone. I belive that if we will increase the number of the photos - the result should be more explicit.
2. After finding the overlay/stamp I would like to find the difference between each image and the overlay/stamp and in this way, get rid of it on each image.

These images are my property and the stamp was put on them by me. Now I need to revert this process.
Please, can You help me with that or send to the right place? I would be very grateful.

Re: Search for mutual/common overlay on many photos

Posted: 2012-02-28T21:01:45-07:00
by fmw42
You can crop or create your stamp as an image and locate that small image inside any larger image using the compare function. You can also find the difference between two same sized images using compare. You can also get the difference between two images using convert image1 image2 -compose difference -composite diffimage. Note that compare of two different size images can be slow depending upon the sizes.

see

http://www.imagemagick.org/script/compare.php
http://www.imagemagick.org/Usage/compare/
viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076
http://www.imagemagick.org/Usage/compose/#difference

in the third link above you now need to add -subimage-search.

Re: Search for mutual/common overlay on many photos

Posted: 2012-02-29T00:09:09-07:00
by anthony
Note however that this is only a difference match for images of the same scale and rotation.

Their are other techniques that are used for scale and rotation independent searching, however these have not been incorporated into ImageMagick, though ImageMagick can to the sub-steps involved with such as search.

Re: Search for mutual/common overlay on many photos

Posted: 2012-02-29T06:56:04-07:00
by elmuSSo
Thanks for answers. Rememer that exevy image has the same size and stamps are et the same position. But I can't recreate the stamp itself. So the only way is to magically dig it up from the images on which it overlayed.

You are saying about searching for difference between images. But is it a good way? If I will search for the difference beetween images, will I get the stamp itself as a result?

Re: Search for mutual/common overlay on many photos

Posted: 2012-02-29T10:40:01-07:00
by fmw42
If you cut out the stamp from one image, you can try to use that for the smaller image when comparing to the larger image. That will probably still find it in the larger image as the best match, thought it won't be a zero rmse error (perfect match). This produces two output images (or frames). The one is the match score image and the other is difference image.


When comparing two images of the same size, the difference image is for the whole image size.

Re: Search for mutual/common overlay on many photos

Posted: 2012-02-29T16:28:18-07:00
by elmuSSo
I dont want to cut the stamp.Stamp is almost the size of the picture. And this stamp i more like overlay, its about 70% transparent. So You can se through it.

Is there a possibility to take 100 images with the same overlay, and find the common/mutual ( sorry,i dont know which word is better ) pixels. I assume, the resulting mutual pixels will be the stamp/overlay. At that stage will get the image of the stamp only. Am I right?

Re: Search for mutual/common overlay on many photos

Posted: 2012-02-29T17:16:39-07:00
by fmw42
I am really not quite sure what you want to do. It seems to me that you need to cut out the stamp from one image. Then use it with compare with each of your images to find the relative shifts of the image that will make the two stamps align. Then you can use -roll to roll each image so the stamps are all at the same location. Then you can use compare to compare each of the same size images, two at a time to find the differences.

Perhaps you can provide links two or three of your images so that we can visualize better what you are trying to do.