"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

opencv contours to Vuforia Renderer?

Vuforia newbie here, so please forgive my ignorance.  I'm mentoring a FTC team using Vuforia on Android with an external webcam.  We're constrained to use the FTC SDK (https://github.com/ftctechnh/ftc_app/tree/master/FtcRobotController) which does much of the work of using Vuforia for us, in particular, this code uses a class called VuforiaLocalizerImpl to interact with the vuforia engine.

In our code, we're getting frames from Vuforia (using the getFrameOnce() method, converting to a bitmap, then a Mat and passing to OpenCV for some further analysis.  From this code we have a set of OpenCV contours we'd like to overlay on the rendered image.  The SDK provides a hook (onFrameRender) which allows users to provide their own overlays.

However, I'm at a loss as to how to get the set of contours rendered using the com.vuforia.Renderer instance provided as part of the SDK.  In particular, the OpenCV contours will be in pixel coordinates, and the renderer is using screen or world coordinates (I can't tell...).

To make this a bit more concrete, let's say I've extracted some contours from OpenCV and then I get a boundingRect from those contours:


Point[] points; 
List<MatOfPoint> contours = getContours();
for (int i = 0; i < contours.size(); i++) {
   points = contours.get(i).toArray();
}

I now have an array of points (in image coordinates) that I'd like to connect with lines and render as an overlay using com.vuforia.Renderer.

My (very out-of-date) OpenGL knowledge would suggest doing something like what's below, but that ignores the difference between world and image coordinates, *and* doesn't make use of the vuforia.Renderer.  What's the proper way to do something like this?

Thanks!

 


glBegin(GL_LINE_STRIP);
for (int i=0; i<points.length; i++) {
  glVertex3f(points[i].x, points[i].y);
}
glEnd();
Attachment