Thank you Julie for providing the link.
The linked example is for rendering a static Bitmap. Rendering a dynamic image on top of VideoCapture based on ImageAnalysis results is more complicated. You will need to buffer up the video frames, wait for ImageAnalysis to finish, then generate an image (the bounding box) and blend it with the buffered videoframe. We understand that this is a common feature request. I plan to work on it in the near future but there is no ETA.
For now there isn't really a silver bullet. If you would like to try it yourself, the right way is using OpenGL. You can use CameraX's internal
OpenGL renderer as your starting point. I understand that this might be challenging if you are not experienced with OpenGL. Alternatively, there is a workaround that you can convert the ImageAnalysis frame to Bitmap, draw on top of it, and then write it to MediaCodec Surface. This is very inefficient and requires you to implement some of the VideoCapture logic.