How to validate water marked image

Best practices, code snippets for common functionality, examples, and guidelines.
ask007
Posts: 5
Joined: Tue May 03, 2016 10:56 am

How to validate water marked image

Post by ask007 » Tue May 03, 2016 11:09 am

Hi,
I have a requirement where I need to validate original image with water marked one. I tried loading image then converting it into Bitmap then compare.

Bitmap expectedImageBmp = Ranorex.Imaging.Load(@"Water_Marked_Image_Path");
Bitmap actualImageBmp = Ranorex.Imaging.Load(@"Original_Image_Path");
Boolean result = Ranorex.Imaging.Compare(actualImageBmp, expectedImageBmp, Imaging.FindOptions.Default);

Is this approach really works with water marked image? Does it validate pixel by pixel? Looking for alternative if any

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to validate water marked image

Post by Support Team » Wed May 04, 2016 3:21 pm

Hi ask007,

To compare two images, I'd suggest using the Ranorex.Imaging.Compare()-method with the following parameters

Code: Select all

var result = Ranorex.Imaging.Compare(expectedImageBmp,actualImageBmp);
This method returns the similarity of both images, which is calculated by comparing pixel by pixel,

Another possibility would be using

Code: Select all

var result = Ranorex.Imaging.Compare(expectedImageBmp,actualImageBmp,1);
This allows you to set the similarity, which is used to combine the images and it will return true or false.

Hope that helps.

Please let me know , if you need any further help.

Regards,
Markus (S)

ask007
Posts: 5
Joined: Tue May 03, 2016 10:56 am

Re: How to validate water marked image

Post by ask007 » Mon May 09, 2016 6:06 am

It explains what I wanted. So using Ranorex.Imaging.Compare() method, image can be compare pixel by pixel.
Thanks for reverting back :)