Search for mutual/common overlay on many photos

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
elmuSSo
Posts: 5
Joined: 2012-02-28T18:23:00-07:00
Authentication code: 8675308

Search for mutual/common overlay on many photos

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

Re: Search for mutual/common overlay on many photos

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Search for mutual/common overlay on many photos

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
elmuSSo
Posts: 5
Joined: 2012-02-28T18:23:00-07:00
Authentication code: 8675308

Re: Search for mutual/common overlay on many photos

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

Re: Search for mutual/common overlay on many photos

Post 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.
elmuSSo
Posts: 5
Joined: 2012-02-28T18:23:00-07:00
Authentication code: 8675308

Re: Search for mutual/common overlay on many photos

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

Re: Search for mutual/common overlay on many photos

Post 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.
Post Reply