Page 1 of 1

Bitmap feature identification

Posted: Tue Jul 23, 2013 9:36 pm
by havitia
I'm having difficulty identifying a bitmap feature, for example

bool rc = imaging.TryFindSingle(Searchbmp, Featurebmp, out match)

The searchbmp is a bitmap containing a set of buttons, and the Featurebmp is a smaller bitmap containing only one of those buttons.

I've tried other method including Contains() and FindSingle() and no luck.

What am I missing? or could someone provide an example of comparing two bitmaps.

Re: Bitmap feature identification

Posted: Wed Jul 24, 2013 12:20 pm
by Support Team
Hello,

Have you tried to adjust the similarity in your method?
You could do that as shown below:
Imaging.FindOptions myFindOptions = new Imaging.FindOptions(0.95);
bool rc = Imaging.Contains(image, feature, myFindOptions);
Regards,
Markus (T)

Re: Bitmap feature identification

Posted: Wed Jul 24, 2013 7:41 pm
by havitia
Thanks, the search completes and identifies the feature. I still have one problem. When the feature is not present the search takes 20-30sec.

When I set:

Imaging.FindOptions myFindOptions = new Imaging.FindOptions(0.95);
myFindOptions.Timeout = new Duration(500);
bool rc = Imaging.Contains(image, feature, myFindOptions);

The timeout has no effect. Is there another way to trigger a timing threshold for this operation?

Re: Bitmap feature identification

Posted: Thu Jul 25, 2013 4:38 pm
by Support Team
Hello,

Is your image to search for a repository element?
If yes, you could simply modify the 'Search Timeout' in the properties of your element in the repository.

The FindOptions.Timeout property only applies to image searches done on elements, not on bitmaps directly (it does not make sense to search a bitmap, only an updated screenshot from an element). So the first method argument always needs to be an element or adapter if you want the timeout to be used.

Regards,
Markus (T)

Re: Bitmap feature identification

Posted: Fri Jul 26, 2013 4:43 pm
by havitia
Thanks, that makes sense and after searching the forum I determined that was the case.

Either way after tweaking Findoptions and Preprocessing I was able to configure almost exactly what I needed and don't need the timeout.