Page 1 of 1

Image Recognition

Posted: Fri Jan 06, 2012 8:01 am
by Praveen597
Hi all,
I am finding difficult to use Ranorex to recognize the color combination.

I have two similar images in which only the color differs from each other.
For eg, one is a colored pic where as other one is black and white pic, now when comparing these two images the ranorex is showing boolean value true even though the colors are different.

Here is my code:

//Capture Image(Colored Image)
Bitmap rightImage= repo.WebDocument.RightSideContainerLayoutRegion.CaptureCompressedImage();

//Here, the right side container layout is changed to another other image( with black and white)

if(Validate.CompareImage(repo.WebDocument.RightSideContainerLayoutRegionInfo,rightImage,new Imaging.FindOptions(0.10), "", false))
{
Report.Success("Image changed successfully");
Report.Screenshot();
}
else
{
Report.Failure("Image not changed");
}


Can some one help me...??

Thanks,
Praveen

Re: Image Recognition

Posted: Mon Jan 09, 2012 5:23 pm
by Support Team
Please, have a look at the documentation of the FindOptions class:
http://www.ranorex.com/Documentation/Ra ... ptions.htm

Your code is comparing the two images using a similarity value of only 10%. Consequently, the CompareImage method will return true even if the two images have only 10% similarity or more.

Regards,
Alex
Ranorex Team

Re: Image Recognition

Posted: Tue Jan 10, 2012 6:52 am
by Praveen597
I have changed the color of the entire image. Right ? Then, how can the image equal to 10% similarity..?

Re: Image Recognition

Posted: Tue Jan 10, 2012 7:27 am
by Praveen597
Even I have tried with 100% similarity but haven't found any progress.

Please help me out.

Re: Image Recognition

Posted: Tue Jan 10, 2012 2:23 pm
by Support Team
Hi,

Please determine the similarity factor of your images with:
double similarity = Imaging.Compare(Bitmap yourBitMap1, Bitmap yourBitmap2)
, is it 100%?
If it is 100% it seems that you are taking the wrong images, to proof this please save the two used images to the hdd like:
Bitmap test = Imaging.CaptureImage(formCalculator);
test.Save("C:/test.bmp");
Are they equal?

Regards,
Markus
Ranorex Support Team