PhotonVision / photonvision

PhotonVision is the free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition.
https://photonvision.org
GNU General Public License v3.0
277 stars 193 forks source link

3-D Processing frame error? #1176

Open Definitely-A-Person opened 9 months ago

Definitely-A-Person commented 9 months ago

Describe the bug In previous versions, when in the 3-D processing mode, the processed image view would display a box over the AprilTag. This is no longer happening for my team (see attached images). Is this a new system, and if so, is this how it is supposed to look? We think there is a bug that is causing the center of the coordinate frame to be something other than the center of the AprilTag. Additionally, distance measurements become less reliable with range.

To Reproduce Steps to reproduce the behavior:

  1. Set camera resolution to 600*800, and calibrate using chessboard.
  2. Set pipeline to AprilTag, 3-D processing mode, and show processed camera view.
  3. Make sure AprilTag family is 36h11, but make no other adjustments to tuning. 4.Look at processed camera view in display while targeting an AprilTag to see error.

Screenshots / Videos Screenshot 2024-01-18 194723 Screenshot 2024-01-18 194832

Platform:

mcm001 commented 9 months ago

That's usually caused by poor camera calibration. Send your settings zip and also a screenshot of the calibration details pop-up for 800x600? (Click on it in the table in the calibration card)

mcm001 commented 9 months ago

Or actually instead of settings zip just pull up that detail card and send me the cal JSON?

https://docs.photonvision.org/en/latest/docs/calibration/calibration.html under accessing calibration images

Definitely-A-Person commented 9 months ago

calibration JSON: photon_calibration_Arducam_OV9281_USB_Camera_1280x720.json Settings (in case needed): photonvision-settings-export.zip

mcm001 commented 9 months ago

You said this was 600*800 but the json you attached is 1280x720?

Anyways clicking into the calibration details (see https://docs.photonvision.org/en/latest/docs/calibration/calibration.html#accessing-calibration-images ) I see very funny numbers. do these make any physical sense to you? they fail vibe check for me hard

image

mcm001 commented 9 months ago

You could try again with mrcal turned off?

mcm001 commented 9 months ago

Other notes:

mcm001 commented 9 months ago

Final spam. your images are not very varied. review our calibration tips to more completely cover the imager and take pictures from more angles. dont be scared to take a -lot- of (still good quality and not blurry) photos -- up to 50 is fine

mcm001 commented 9 months ago

i exported your calibration to images and ran it back through mrcal in python and got out much saner numbers. might be a bug in our code, maybe in the initial guess? great to have this dataset so we can keep digging offline.

image

# generated on 2024-01-20 12:20:34 with   /usr/bin/mrcal-calibrate-cameras --corners-cache corners.vnl --lensmodel LENSMODEL_OPENCV8 --focal 1200 --object-spacing 0.0254 --object-width-n 7 '*.png'
<snip>
    # intrinsics are fx,fy,cx,cy,distortion0,distortion1,....
    'intrinsics': [ 909.6867196, 903.2488663, 577.5179279, 340.1756753, -0.01338670833, -0.08025219906, 0.003925534879, -0.02027513374, 0.1065605664, -0.04406133662, -0.007898860056, -0.01494201441,],
mcm001 commented 9 months ago

what happens if you edit the calibration json you sent me to have these numbers intead? does stuff look saner?

mcm001 commented 9 months ago

I just recalibrated using opencv and get these intrinsics, which still seem bad. At this point i suggest trying again, taking care to collect good calibration images. image