Vision Question

So I’m able to get the vision processing code to work fine when its connected to the laptop, only, when its in the intensity tabs. The color tab isn’t able to recognize the rectangle for me. I’m wondering how I would change the code so that when the vision processing is running on the robot, it automatically uses the intensity tab to find the distance.

Also I’ve noticed that when the hoop is angled away from the camera the distance starts to become off by about 1-3 ft. I tried correcting this by having the use the top-bottom to calculate the distance, but then my distances were off by 5-8 ft.

If anyone could help me with these problems I would greatly appreciate it.

Color mode will not work without calibrating it to your robot’s source color. You can do that by clicking on the color in the image. To change the color or change it to intensity mode, be sure to right click on the control you want to change and select the menu item Data Operations>>Make Current Value the Default. The next run/build will use this as the initial value.

When you changed the distance code to use the height, did you change the constants for the tape length and the image size? The rect is 24" wide and 18" high, and the camera is 320 wide, but 240 high.

Greg McKaskle

I’ve clicked on the color with out white LED attached to the camera, but the rectangle still doesnt get recognized in color mode, which is why I’ve been using intensity.

Also with the distance error, I changed the measurement to 1.5ft, and used the y image resolution instead of the default x, yet I still keep getting measurements that are 5 or more feet off.

Ahh. White lighting doesn’t have a very distinct color, so yes, intensity is the right solution. If you post the modified distance code or a picture of it, I’m sure someone will be able to help find the issue.

Greg McKaskle

Heres the code for the distance:

The code you attached is dividing 1.5 by the width (left - right). Change that to use the height of the bounding box.

Greg McKaskle

So if I change left and right to top and bottom it should be fine?

That is how I’d do it.

Greg Mckaskle