Matching image with another image and get result in percentage format

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
rkn
Posts: 2
Joined: 2015-03-13T16:51:51-07:00
Authentication code: 6789

Matching image with another image and get result in percentage format

Post 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
Last edited by rkn on 2015-03-13T22:00:17-07:00, edited 2 times in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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
snibgo's IM pages: im.snibgo.com
rkn
Posts: 2
Joined: 2015-03-13T16:51:51-07:00
Authentication code: 6789

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

Post by rkn »

Thanks a lot
darksonny
Posts: 1
Joined: 2016-07-17T04:12:15-07:00
Authentication code: 1151

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

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply