Forum Discussion

simonaferrara's avatar
simonaferrara
Frequent Contributor
4 years ago
Solved

How to retrieve coordinates of an image inside another one

Hi all,

 

I'm new with Test Complete, and I'm trying to undestand how to compare images within my desktop app using the RegionObj.Check method. I hope that you can help me. I'll attach an image just to better explain.

 

 

I've got this issue: the image contains itself another image, and, using for example Object Spy or the CheckPoint Image recording, I can retrieve only all the image, with all its background (the one that I've highlighted with red color) and I cannot retrieve the image that I want (the one that I've highlighted with green color).

I've got the Regions image that contains only the image highlighted with green color, so in this way I'm not able to do the image comparison.

 

I've found the Regions.CreateRegionInfo method that could be used as first parameter for the Check method to select a specific area within the image, using the ClientX-Y coordinates and Width and Height parameters; but I don't find how I can retrieve these coordinates for the image highlighted in green, so I don't understand which coordinates insert on it! (maybe if the coordinates could be relative within the red one it will be better).

 

I hope you can help me, it is rather urgent.

 

Thanks!

Simona

 

9 Replies

    • simonaferrara's avatar
      simonaferrara
      Frequent Contributor

      Marsha_R 

      It should be developed in C or C++, while the TestComplete project is developed in VBScript.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Take a look at the Advanced version of the Object Spy results for the big image.  Drill down in all the options and see if you find the little image hidden as a value in there somewhere.

  • Wamboo's avatar
    Wamboo
    Community Hero

    What are the differences between the pictures?

    Just a small img inside a big one?

    Why not compare it all, that is, with a green background. It will also compare the little picture inside the big one

    • simonaferrara's avatar
      simonaferrara
      Frequent Contributor

      Wamboo 

      Yes, it's just a small img inside a big one.

      I could compare it all, but I want also to understand if it should be possible to consider only the smaller one to compare it, for example, with a selection of only the (smaller) image that might be displayed, without considering the background.

      • Wamboo's avatar
        Wamboo
        Community Hero

        If this image is added to the application as a whole, it will be very difficult to identify the internal content of the image (i.e. outside the background).

         

        If you add this yao two separate photos, you should identify it with object spy.

         

        If not...

         

        You can combine by trying to calculate the coordination from e.g. upper left corner and left side.

         

        But these operations will be expensive so it will come to one and the same thing from the question of at least optimization