mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Merge pull request #28422 from Shrutikasri04:first-pr
docs(calib3d): fix grammar and clarify radial distortion formula in camera calibration tutorial #28422 This PR improves the camera calibration tutorial documentation by: - Fixing minor grammatical issues for better readability. - Clarifying the radial distortion model by explicitly defining r² = x² + y². These changes do not affect functionality and are intended to make the mathematical explanation clearer for readers and new users.
This commit is contained in:
@@ -12,9 +12,9 @@ Camera calibration With OpenCV {#tutorial_camera_calibration}
|
||||
| Compatibility | OpenCV >= 4.0 |
|
||||
|
||||
|
||||
Cameras have been around for a long-long time. However, with the introduction of the cheap *pinhole*
|
||||
Cameras have been around for a very long time. However, with the introduction of the cheap *pinhole*
|
||||
cameras in the late 20th century, they became a common occurrence in our everyday life.
|
||||
Unfortunately, this cheapness comes with its price: significant distortion. Luckily, these are
|
||||
Unfortunately, this low cost comes with a trade-off: significant distortion. Luckily, these are
|
||||
constants and with a calibration and some remapping we can correct this. Furthermore, with
|
||||
calibration you may also determine the relation between the camera's natural units (pixels) and the
|
||||
real world units (for example millimeters).
|
||||
@@ -22,8 +22,10 @@ real world units (for example millimeters).
|
||||
Theory
|
||||
------
|
||||
|
||||
For the distortion OpenCV takes into account the radial and tangential factors. For the radial
|
||||
factor one uses the following formula:
|
||||
For distortion, OpenCV takes into account both radial and tangential factors. For the radial
|
||||
factor one uses the following formulas:
|
||||
|
||||
\f[r^2 = x^2 + y^2\f]
|
||||
|
||||
\f[x_{distorted} = x( 1 + k_1 r^2 + k_2 r^4 + k_3 r^6) \\
|
||||
y_{distorted} = y( 1 + k_1 r^2 + k_2 r^4 + k_3 r^6)\f]
|
||||
@@ -64,10 +66,10 @@ objects. Currently OpenCV supports three types of objects for calibration:
|
||||
- Symmetrical circle pattern
|
||||
- Asymmetrical circle pattern
|
||||
|
||||
Basically, you need to take snapshots of these patterns with your camera and let OpenCV find them.
|
||||
In practice, you need to capture multiple images of these patterns using your camera and let OpenCV find them.
|
||||
Each found pattern results in a new equation. To solve the equation you need at least a
|
||||
predetermined number of pattern snapshots to form a well-posed equation system. This number is
|
||||
higher for the chessboard pattern and less for the circle ones. For example, in theory the
|
||||
higher for the chessboard pattern and lower for circle-based patterns.For example, in theory the
|
||||
chessboard pattern requires at least two snapshots. However, in practice we have a good amount of
|
||||
noise present in our input images, so for good results you will probably need at least 10 good
|
||||
snapshots of the input pattern in different positions.
|
||||
@@ -148,8 +150,8 @@ Explanation
|
||||
is defined in squares, but detection result is list of inner corners and that's why is smaller
|
||||
by 1 in both dimensions.
|
||||
|
||||
Then again in case of cameras we only take camera images when an input delay time is passed.
|
||||
This is done in order to allow user moving the chessboard around and getting different images.
|
||||
In the case of live cameras, we only capture images when an input delay time is passed.
|
||||
This is done to allow the user to move the chessboard around and getting different images.
|
||||
Similar images result in similar equations, and similar equations at the calibration step will
|
||||
form an ill-posed problem, so the calibration will fail. For square images the positions of the
|
||||
corners are only approximate. We may improve this by calling the @ref cv::cornerSubPix function.
|
||||
@@ -160,6 +162,7 @@ Explanation
|
||||
visualization feedback purposes we will draw the found points on the input image using @ref
|
||||
cv::findChessboardCorners function.
|
||||
@snippet samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp pattern_found
|
||||
|
||||
-# **Show state and result to the user, plus command line control of the application**
|
||||
|
||||
This part shows text output on the image.
|
||||
@@ -170,6 +173,7 @@ Explanation
|
||||
Then we show the image and wait for an input key and if this is *u* we toggle the distortion removal,
|
||||
if it is *g* we start again the detection process, and finally for the *ESC* key we quit the application:
|
||||
@snippet samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp await_input
|
||||
|
||||
-# **Show the distortion removal for the images too**
|
||||
|
||||
When you work with an image list it is not
|
||||
|
||||
Reference in New Issue
Block a user