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.
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?"
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.
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?