No announcement yet.

How does TFObjectDetector draw to screen - tfodMonitorViewIdParent

  • Filter
  • Time
  • Show
Clear All
new posts

  • How does TFObjectDetector draw to screen - tfodMonitorViewIdParent

    How can you draw to the screen - similar to how object detection info is drawn to tfodMonitorViewIdParent? We aren't currently using tfod and Vuforia "owns" the camera and draws to the screen. We grab frames from Vuforia and process them. We would like to be able to draw info back to the screen.

  • #2
    There's no "easy" way to draw on the Vuforia camera monitor as far as I'm aware. The TFOD camera monitor is actually fully separate from the Vuforia one (the vuforia one is just hidden).

    Being the author of the library, I am of course biased, but I'd highly recommend trying EasyOpenCV. It's a framework that is purpose built for FTC that lets you seamlessly integrate OpenCV code into your OpMode. Drawing on the preview is a breeze with the standard OpenCV drawing functions for lines, rectangles, text, circles, etc. and individual pixel analysis (what I assume you are doing now) is equally trivial, and even more flexible since you can use OpenCV to convert to other color spaces which lend themselves better to FTC game elements.


    • #3
      4634 Programmer - We are using OpenCV and have been for a few years. We don't use EasyOpenCV, but have a fairly easy way to integrate opencv that we have honed. We can go camera->vuforia->opencv, or camera->opencv directly. And we can draw back to the surface when using the latter, but we like to be able to at least expose the students to vuforia - and also claim that we can use it in ENB, etc. But, I feel that vuforia's accuracy is limited beyond a few feet.
      But the TFOD examples show initialising vuforia first - so I assumed that TFOD is getting frames from vuforia, processing (similar to our opencv flow), and then drawing back to the screen.

      In the activity_ftc_controller.xml, there is an unnamed FrameLayout with a "monitorContainer" LinearLayout - which has a "cameraMonitorViewId" LinearLayout and another FrameLayout named "tfodMonitorViewId".

      This is a little different from pre tfod layout. Can we draw to the tfodMonitorView if we aren't using tensorflow?


      • #4
        TFOD is getting frames from Vuforia, yes. Personally I would advise you to avoid feeding OpenCV through Vuforia, because you're wasting CPU cycles that way and lose the ability to directly control camera parameters such as exposure, focus, white balance, resolution, and sensor gain.

        The TFOD monitor is implemented on top of an image view. If you really want to pursue that route, here is probably a good place to start investigating how it's implemented in the SDK.