Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
documentation:vision:camera_calibration [2023/01/22 20:45] – pontusr | documentation:vision:camera_calibration [2023/01/25 05:49] (current) – marcusn | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== OpenCV ===== | ===== OpenCV ===== | ||
- | This approach is based on the opencv documentation for camera calibration in the following [[https:// | + | This approach is based on the opencv documentation for camera calibration in the following [[https:// |
The code for camera calibration expects images of checkerboards taken with the camera for which we need to compute the instrinsic camera parameters. The size of the checkerboard needs to be supplied since the opencv function [[https:// | The code for camera calibration expects images of checkerboards taken with the camera for which we need to compute the instrinsic camera parameters. The size of the checkerboard needs to be supplied since the opencv function [[https:// | ||
Line 12: | Line 12: | ||
==== Taking Pictures With a RealSense Camera ==== | ==== Taking Pictures With a RealSense Camera ==== | ||
+ | |||
+ | Image saving with a realsense camera has been implemented in [[https:// | ||
+ | |||
+ | If the pipeline does not receive a frame from the camera within 5 seconds the following error will be thrown | ||
+ | |||
+ | < | ||
+ | |||
+ | In which case one should check that the camera works and sends frames to the computer with realsense-viewer. | ||
+ | |||
+ | It is very important to check if the camera is recognized as a USB2 device or USB3 device since USB2 supports a smaller sets of resolution than USB3. If a resolution that is not possible is requested (for example if the camera is detected as a USB2 device and the expected resolution is too big) the pipeline throws the following error: | ||
+ | |||
+ | < | ||
+ | |||
+ | In which case one should check what resolution the frames from the camera have with realsense-viewer to verify that the expected resolution is correct. | ||
+ | |||
+ | After the images have been taken duplicates should be removed as well as blurry pictures. Even if it might be possible for opencv to find the checkeboard in a blurry images this will introduce noise to the estimate of the intrinsic camera parameters which is not desirable. | ||
==== Computing the Instrinsic Parameters ==== | ==== Computing the Instrinsic Parameters ==== | ||
+ | |||
+ | The intrinsic camera parameters for a specific camera can be computed from a set of images of checkerboards taken by that camera, this is implemented in [[https:// | ||
+ | |||
+ | ^ Argument Name ^ Description | ||
+ | | -height | ||
+ | | -width | ||
+ | | -size | Length of checkerboard squares in millimeters. | ||
+ | | -f | name of folder where images are stored. Camera parameters are also saved in this folder. True or False. | ||
+ | | -pause | ||
+ | |||
+ | The script prints the result for each image wether it was able to detect a checkerboard or not, if the wrong height and width are supplied the checkerboard might still be detected in 1 in 10 images depending on how incorrect the values are. If the values are correct, however, the checkerboard should be detected in all but the blurriest pictures as long as the whole checkerboard is in the image. | ||
+ | |||
+ | The camera parameters are saved in a text file called ' | ||
+ | |||
+ | ^ Output ^ Name ^ Contains | ||
+ | | 1 | calib | $f_x$, $f_y$, $c_x$, $c_y$ | | ||
+ | | 2 | distort | $k_1$, $k_2$, $p_1$, $p_2$, $k_3$ | | ||
+ | |||
+ | The first tuple, calib, contains the intrinstic camera matrix where $f_x$ and $f_y$ are the focal lengths in the $x$- and $y$-direction and ($c_x$, $c_y$) is the location of the pixel center. The distortion parameters $k_1$, $k_2$, $p_1$, $p_2$ and $k_3$ are parameters which estimate how much straight lines captured by the camera are bent. This bending effect can be removed with the help of opencv' | ||
===== SkiROS ===== | ===== SkiROS ===== |