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
264 stars 180 forks source link

3d bounding box is distorted when top box is behind camera #1231

Open gerth2 opened 6 months ago

gerth2 commented 6 months ago

Describe the bug Strange distortion for apriltag bounding boxes that are very close

image

all good

image

Still fine

image

oop

To Reproduce Steps to reproduce the behavior:

Calibrate 3d on any camera

Get an apriltag very close to the camera

Screenshots / Videos see above

Platform:

Additional context I'm assuming this is because Calib3d.projectPoints does not handle the negative X real world points case well? Everything else is a floating point number so it shouldn't be that bad?

mcm001 commented 6 months ago

Yeah, a brief googling indicates that this breaks things. How do we draw the wire frame field for simulation? That has lines out of the camera FOV

mcm001 commented 6 months ago

In some cases the distortion values you get from calibrateCamera result in a distortion function that is non-monotonic and the image (or projected points) can “wrap around”…So this could be what you are seeing. Maybe.

https://forum.opencv.org/t/projectpoints-point-visibility-with-distortion/7055/3