Adding crosshairs to camera image

slight noob here with another question

My team’s programmer is overtaxed with arm issues so I was assigned the task of making camera code.

I already tacked the task of making it so a driver’s button flips the camera servo backwards and flips the image 180 degrees (minibot backup camera mode).

the next task is adding crosshairs to the image to assist with camera aiming. the programmer mentioned something about a bitmap overlay but beyond that I am lost.

I am trying do do it all in the robot code and not the dashboard to make the code more modular.

any ideas on where to start?

The dashboard image comes from a specific camera data stream that is just passed through the cRIO with no modification. It would be very difficult to add crosshairs using robot code.

On the other hand, it is extremely easy to do it in the Dashboard program using IMAQ Image Overlay functions.

i think the programmer also mentioned that it was going though the access point to bypass the crio… not sure if that matters… do i need to put the image flip in the dashboard too then?

Yes, if the camera is wired directly to the DLink bridge both the image flip and overlays would have to be done on the dashboard.

The default dashboard camera display also has to be modified to read directly from the camera if your programmer has not already done so. This thread has details on how to do that as well as some general information on custom dashboards.

Flip the image on the camera or in the Dashboard.
For a crosshair you might find a multi-line or oval overlay easier than a bitmap.Vision Motion->Vision Utilities->Overlay
I’ve also done a crosshair just by drawing it on the Dashboard front panel itself and dragging it on top of the camera output.
No computational work required that way.

Attached is a Dashboard overlay example from last year’s default framework.

As a mechanical way to do what you want, I saw one team had placed a pointer stick on their robot, between the camera and the pole. As you’re watching the image, line up the stick with the pole and you’re golden. I thought it was rather clever.

Camera looked through a piece of polycarbonate with strips of electrical tape indicating left and right limits of the compliance of the minibot deployment mechanism. If robot was touching the base and pole was between the markers, deployment was successful every time.

I was going to mention. As a last ditch MacGyver, a rubber band around the monitor makes a decent horizontal crosshair.

But being a SW guy, this also isn’t hard to do the right way. The game code for last year included some overlay code that drew a light blue line vertically on the center of the screen and some ovals on the target. You can use it as an example.

The code in the loop marked the various ellipses, and the single icon on the right drew the line. The icon on the far left returns the image sizes, or you can use constants if the image size is well known. Add this to the dashboard code as was done in 2010.

Greg McKaskle

Clipboard 1.png

Clipboard 1.png

got it.

what i did is I added the servo postion to the dashboard typedef and then made a custom dashboard (I have done this a few times before). I then discived all of the NI vision (as opposed to FIRST vision) stuff… and I have it so:

it overlays 2 rectangles on the image for each line of the crosshair (1 px seemed too thin…) and has a case structure that flips the image 180 degrees when the servo angle reaches a certain point (i put in 110 degrees).

sound good?

If it looks good, it sounds good.

Greg McKaskle

i modded it so the crosshairs change when flipped over… the code will be tested and dialed in tonight.

some minor tweaks and it works great now. life is good.