From abc3930a3e07cc86b3ad096421b2cb8ad1b2ed7d Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Thu, 30 Mar 2023 14:11:07 +1300 Subject: [PATCH] vault backup: 2023-03-30 14:11:07 --- content/notes/10-3d-Cameras.md | 67 ++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/content/notes/10-3d-Cameras.md b/content/notes/10-3d-Cameras.md index 0b4d4b98a..b74373278 100644 --- a/content/notes/10-3d-Cameras.md +++ b/content/notes/10-3d-Cameras.md @@ -96,8 +96,67 @@ TRANSFORMING CAMERAS > only need to apply inverse matrix to the 3d points of the world TRANSFORM THE WORLD (!) -- To transform a camera by -- Apply inverse, , to points +- To transform a camera by $T$ +- Apply inverse, $T^{-1}$ , to points - To move the camera left 3 units, move the world right 3 units -- To rotate the camera about , rotate the world about -- The relative motion of the camera and the world is the same \ No newline at end of file +- To rotate the camera $45⁰$ about $Z$, rotate the world $-45⁰$ about Z +- The relative motion of the camera and the world is the same + +ROTATE AND TRANSLATE A CAMERA +![|300](https://i.imgur.com/HKjLw2w.png) + +CAMERA CALIBRATION +``` +double cv::calibrateCamera( + // Input parameters + //std::vector> objectPoints, + //std::vector> imagePoints, + //cv::Size imageSize, + // Output parameters + //cv::Mat cameraMatrix, + //std::vector distCoeffs, + //std::vector rotationVectors, + //std::vector translationVectors); +``` + +CALIBRATION TARGETS +- Input is 3D-2D matches + - Want easy-to find 2D points + - Need known 3D co-ordinates +- Planar targets common + - Easy to make with a printer + - Chess/Checkerboards + - Grids of dots or lines +- Is a 2D pattern enough? +![|200](https://i.imgur.com/dNpoWGM.png) + +3D POINT LOCATIONS +- Choice of co-ordinates + - X-Y plane is the target + - Origin at one internal corner + - Z runs into the target plane +- Need to decide on units + - Best to use real-world units + - Here 1 square = 1cm + - Can use 1 square = 1 unit +![|200](https://i.imgur.com/BM0FzYg.png) + +FINDING CHECKERBOARD CORNERS +- OpenCV method (in brief) + - Threshold image to B&W + - Look for quads + - Link quads -> checkerboard + - Sub-pixel refinement +![|200](https://i.imgur.com/Gfhn2kX.png) + +MATCHING 2D TO 3D POINTS +- Corners are in rows/cols + - View of all corners required + - Aligns 2D corners to 3D target point locations +- Targets often odd-sized + - Example here is 7x6 + - Why is this better than 8x8? + - Is this required? +![|200](https://i.imgur.com/5XIFVKT.png) + +