• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

How to draw boundingBox around detected object?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am currently working on an object detection application (written in Java) on Android that uses Google ML Kit to detect objects within a live streamed camera preview. My issue today lies with WHY exactly the code needed to display a boundingBox around the detected object isn't appearing within my display.

The application successfully launches and I see camera preview stream is visible, the only issue is that it is unable to display boundingBox Rectangle around the detected objects, despite code being put in place to implement this. The application itself is able to detect objects, it's merely the visual display that is missing. My code displayed below states the box, and I understand that I must draw the boundingBox myself, and my question is specifically aimed at how I would go about trying to draw it. It is a single activity application:



Any information needed to supplement this question will be provided upon request.
 
Mason Buchanan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is an updated attempt; I have used this example from Google Codelabs that demonstrates how one would use a facial feature detection dependency from Google ML to draw a rectangular box around the detected face. This is the part of code that was of interest to my problem;



I had attempted to use it as reference to draw a box around detected objects in the same way only to no avail. However, I have learned that I must draw the graphic overlay in order for the results to be displayed on the application. Perhaps I should have reworded this question to "How to draw overlay using Google ML?"
 
Mason Buchanan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I was using java.awt.Image, I'd create a createGraphics() image from Graphics2D object and then draw on that. However, this is not the case. I'm using a android.media.Image, and so I'm unaware on how to draw a graphic overlay on my input image. If anybody could provide any assistance, it would be much appreciated.
 
Mason Buchanan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another update; I have added the following code within the onSuccess method using this StackOverflow answer in order to attempt to draw an overlay within my application display, and wonder why this attempt has not been successful?

 
I have always wanted to have a neighbor just like you - Fred Rogers. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic