Menu

Bounding box of TemplateMatcher?

Anonymous
2017-10-18
2017-10-18
  • Anonymous

    Anonymous - 2017-10-18

    The FValuePixels from the TemplateMatcher will give the X,Y coordinates of the center of a match, but is there a way to get the bounding box? Apologies if this is obvious.

     
    • Jonathon Hare

      Jonathon Hare - 2017-10-18

      Good question! At present, you'll need to write your own code to do that I'm afraid. I guess the simplest way would be to get the bounds rectangle of the template and translate it so the centre is at the x,y coordinates given by the template matcher:

      FValuePixel p = ...;
      Rectangle r = template.getBounds();
      r.x = p.x + r.width / 2;
      r.y = p.y + r.height / 2;
      

      If this is something you'd like to see added to the library in the future, feel free to file a feature request at https://github.com/openimaj/openimaj/issues

       
  • Anonymous

    Anonymous - 2017-10-18

    Is the bounds rectangle of the template exposed somehow? Or are you saying template.getBounds is the method that needs to be added? Thanks for the quick response on this.

     
    • Jonathon Hare

      Jonathon Hare - 2017-10-18

      I was assuming that template referred to the FImage instance reresenting the template; the above code should work as is under that assumption without the need for ant methods to be added,

       
  • Anonymous

    Anonymous - 2017-10-19
    Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.