remove object from image with other image?

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
arane27
Posts: 3
Joined: 2015-08-21T03:22:19-07:00
Authentication code: 1151

remove object from image with other image?

Post by arane27 »

Hello guys,
I can't find the solution for this....

I have 2 images:

1º Image:

Image


2º image:

Image




I need to replace "Object C" from 1º image to white pixels using 2º image...


Sorry for my English...
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: remove object from image with other image?

Post by Bonzo »

I think you should post an actual example.

How do you know where OBJECT C is in OBJECT A - is it always in the same place, do you have the co ordinates or will Imagemagick have to find it?
arane27
Posts: 3
Joined: 2015-08-21T03:22:19-07:00
Authentication code: 1151

Re: remove object from image with other image?

Post by arane27 »

Bonzo wrote:I think you should post an actual example.

How do you know where OBJECT C is in OBJECT A - is it always in the same place, do you have the co ordinates or will Imagemagick have to find it?

IM has to find object C.
I'm using the command -->

Code: Select all

compare -subimage-search source.jpg objToFind.jpg out.jpg
IM finds the difference, but how can I replace the found difference with white pixels or just blur that region, is there anyway?

wich -metric should I use?

Thanks for quick reply!!
arane27
Posts: 3
Joined: 2015-08-21T03:22:19-07:00
Authentication code: 1151

Re: remove object from image with other image?

Post by arane27 »

Here is an example.


I have these images -->


Image
Image

And here is the region to find and detele/blur/change -->
Image


With command I wrote above I get this result -->
Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: remove object from image with other image?

Post by snibgo »

For the original post:

Code: Select all

compare -metric RMSE first.jpg objects_To_Remove.jpg -subimage-search NULL:
The result is:

Code: Select all

1092.34 (0.0166681) @ 31,279
So the found image is positioned at (31,279).

Code: Select all

convert first.jpg ( objects_To_Remove.jpg -fill Red -colorize 100 ) -geometry +31+279 -composite z.png
This paints a red rectangle over the area. I choose red, so you can see it. Change "red" to "white" if you want.
snibgo's IM pages: im.snibgo.com
Post Reply