Image recognisation and validation

Class library usage, coding and language questions.
Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Image recognisation and validation

Post by Deepak_Singh » Sun Mar 23, 2014 7:54 am

Hi all,
I have seen the screencast of image recognisation. Its very helpful thanks for it.
But my question it how will we execute the same thing via Code Module.
Can you post the code here.
Thanks in advance.
:lol:

Swisside
Posts: 92
Joined: Thu Oct 10, 2013 10:40 am

Re: Image recognisation and validation

Post by Swisside » Mon Mar 24, 2014 10:25 am

Hello,

Have a look at http://www.ranorex.com/support/user-gui ... html#c3325

Is it what you were looking for ?


Regards

Swis
A simple thank you always does wonders !

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Image recognisation and validation

Post by Deepak_Singh » Wed Apr 02, 2014 6:55 pm

Nope buddy the guide did not help me a lot.
I want to get a image and create a small rectangle out of it and than check whether the image contains the small rectangle or not.

Can anyone help me with the code out here.

Thanks in advance,
Deepak

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Image recognisation and validation

Post by Support Team » Fri Apr 04, 2014 5:34 pm

Hello Deepak,

I am not exactly sure if I understand your question correctly. Do you want to draw a rectangle into your image using Ranorex? If yes, unfortunately this is not possible using the Ranorex API, but maybe you can use the .NET Framework to achieve this.

Regards,
Bernhard
.
Image

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Image recognisation and validation

Post by Deepak_Singh » Sun Apr 06, 2014 3:27 pm

Hi support team,

Its just that i want to know how to do image based validation for both compare and contains with scripting.

I performed record and play and it was very fine.
But some code in code module starting with #Image
was present how can we do that via scripting is my question.

Thanks,
Deepak

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Image recognisation and validation

Post by odklizec » Mon Apr 07, 2014 8:45 am

Hi Deepak,

It would be easier to help you out if you could post a sample of recorded project describing what you exactly want to achieve. It would be best if you could record a demo with publicly available application (like the KeePass demo included in Ranorex samples).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Image recognisation and validation

Post by mzperix » Fri Apr 11, 2014 7:53 am

Hi Deepak,

Make note, that my experience is this: if something can be done in Ranorex studio, than it can be done from user code also.

Look into image based automation in Ranorex studio: http://www.ranorex.com/support/user-gui ... ation.html

As you will see Ranorex is capable of getting an image of an element, then select the part of an image to be the base of recognition.

Just follow the guide and look at the generated code, so you will have some clue on how to achieve this.

Best Regards,
Zoltán

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Image recognisation and validation

Post by odklizec » Fri Apr 11, 2014 8:28 am

I think he wants to know if there is a way to automatically (via code) create the "image feature data" section of code, which is automatically added during recording. I believe the answer is no.

Deepak, if you want to use Ranorex in pure coded way, then you would need to code things yourself. You can use the code created by recording, modify it or create your own code based of the recorded code.

Many automation professionals say that they don't use Record feature because they can produce cleaner code and in many cases also faster than using recording (because they don't need to optimize the recorded code). That may be true. But because you are clearly a Ranorex beginner, I would suggest you to use Recording as much as possible. Learn how the things work, what code is created by Recording and then start writing your own code in UserCode.cs or start using Code modules. I see no point in abandoning Recording, because you can learn a lot from the recorded code.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Deepak_Singh
Posts: 76
Joined: Fri Mar 14, 2014 2:37 pm

Re: Image recognisation and validation

Post by Deepak_Singh » Fri Apr 11, 2014 10:23 am

Hi odklizec,

Yes exactly I wanted that #image feature data thing via code.
Tried it via code but was not working and giving errors. As you guys already know that I am a beginner of Ranorex but still I believe in coding. For reference I sometimes try Recording but never use them because I think if you ask a small kid to just click Record and Play then he/she will also be able to do, then what is the use of Engineers.

Coming back to the topic. For now as I am not getting any help for Image based automation, I have used some other logic to replace Image based automation and its working fine for me. :wink:

But still I would hope that some one could try it via code and post the code here so that all the beginners can find it easy to achieve these tasks(Image based automation via coding). 8)

Regards,
Deepak :)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Image recognisation and validation

Post by odklizec » Fri Apr 11, 2014 12:07 pm

Deepak,

What errors exactly did you get? Are you sure the objects referenced in Image Feature Data code are stored in repository? It would be easier to help you out if you create a small sample project and post it here for review (e.g. using keepass sample app included in Ranorex samples).

I can't be wrong, but I'm almost sure there is no "automatic" way to generate Image Feature Data section from the code (outside Record feature). You simply need to add some images to repository and then code the appropriate content for "Image Feature Data" by yourself.

In my opinion, if Record feature is used wisely, it could save you a lot of time and energy that you would spend with writing every line of code. It's just easier to record small parts of scenario and copy/edit the generated code. This approach is especially handy if you just starting with Ranorex. You can't run before you learn how to walk ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration