A Step by Step Run-through of FRC Vision Processing


Clients using ntcore 2018 or newer will only synchronize entries that have been set client-side on a reconnect. So if the robot sets entries “A” and “B” and client changes the value of “B”, when the server restarts and connects to the client, it will only receive the changed “B” value - it will have to recreate the “A” entry server-side for it to exist.


I am normally involved in scouting but volunteered to look into vision tracking for this year. Since I don’t normally get access to the robot (probably a good thing), I have setup a standalone environment where I enter the image points manually and run the code from the whitepaper. I have a Logitech C930e which I have calibrated and am taking images at 640x480.

I have run a few test images and the results aren’t quite right. Angle 1 looks reasonable but the distance is off by quite a bit. Here are the details from one of the tests

Camera_Matrix - [354.3783072815733, 0.0, 302.13735986949223], [0.0, 351.4154778001233, 265.0460326031293], [0.0, 0.0, 1.0]]

Distortion_Coeffs -[-4.0927618319459197e-01,
2.16383244830097e-01, -1.554154605770095e-03, 3.8508678850099663e-04,

Model Points
(-5.938, 2.938, 0.0), # top left
(-4.063, 2.375, 0.0), # top right
(-7.375, -2.500, 0.0), # bottom left
(-5.438, -2.938, 0.0), # bottom right

# Right target
(3.938, 2.375, 0.0), # top left
(5.875, 2.875, 0.0), # top right
(5.375, -2.938, 0.0), # bottom left
(7.313, -2.500, 0.0), # bottom right

Image Points
(138.000, 121.000),
(173.000, 129.000),
(122.000, 210.000),
(157.000, 216.000),
(292.000, 125.000),
(319.000, 115.000),
(314.000, 200.000),
(339.000, 190.000),

Output - Distance =21.27255 Angle1 = -11.148 Angle2 = -14.509 X = -4.11
Actual - Distance = 30 Angle1 = -10 X = -11

Is there some type of scaling factor that needs to be applied based on the image resolution?




There is no scaling. It is all in the camera_matrix. For 640x480, your numbers look off. Our camera produced:
[[513.9968598587443, 0.0, 312.9144878269727], [0.0, 515.4717581194664, 244.06799700442556], [0.0, 0.0, 1.0]]
The “500” numbers are crucial; those are essentially the field of view (well, inverted and heavily calculated), so the fact that they are very different is suspicious.

BTW, you might want to use the C930 in wide mode. It is a 16x9 camera, so should have a mode close to 840x480, but that is kind of high for the FMS bandwidth limit. We will be using 424x240 on the field. The extra FOV is nice.


I will rerun the calibration at 420x240 and see what the camera matrix numbers look like.




When doing a calibration, make sure to make one run through all the pictures and output them with the found points drawn on. It is not uncommon for the routine to find bad points, and those will mess up the calibration. Delete the bad photos from your set and do a second run to get the good numbers.