Page 1 of 1

Matching image with another image and get result in percentage format

Posted: 2015-03-13T17:35:26-07:00
by rkn
Hi all,
I am newbie to imageMagick. I have a requirement to verify that image present in my application or not. For this I am taking the screenshot of my app then I have to check in captured app screenshot, contains a particular image or not which I can pass a expected image. Using rmagick, it is giving output as an image with highlighted area that is matched but instead of getting output as an image I want output in percentage format means how much percentage it was matched. Hope, I am able to clarify my query.
Image1(parent image, whole app screen shot)
Image2(child image, small image which will be present in parent image )
If image2 present in image1 then output 100% matched

Re: Matching image with another image and get result in percentage format

Posted: 2015-03-13T18:27:07-07:00
by snibgo
"Compare" gives a score in the range 0 to 1. A script could multiply by 100. See http://www.imagemagick.org/script/compare.php

Re: Matching image with another image and get result in percentage format

Posted: 2015-03-13T21:45:53-07:00
by rkn
Thanks a lot

Re: Matching image with another image and get result in percentage format

Posted: 2016-07-17T04:21:56-07:00
by darksonny
Sorry with this necrobumping action, I have had this same doubt than the user forum. Snibgo when you said this:

""Compare" gives a score in the range 0 to 1. A script could multiply by 100."

In the link you gave I dont understand exactly what did you mean, could you explain that quote posted earlier please?

This part form the link:

"-> compare -channel red -metric PSNR rose.jpg reconstruct.jpg difference.png
19.63"

That 19.63 what does it mean? is the percentage or is some kind of value?
thanks!

Re: Matching image with another image and get result in percentage format

Posted: 2016-07-17T05:37:52-07:00
by snibgo
There are different metrics. See http://www.imagemagick.org/script/comma ... php#metric . Some (eg RMSE) have a scale from zero to one, where one means a perfect match and zero means as different as possible. For those, multiply by 100 to get a percentage.

The PNSR metric has a scale from zero to infinity, where infinity is a perfect match and again zero means as different as possible.