Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
67acfc6e
Commit
67acfc6e
authored
Oct 30, 2017
by
KUANG Fangjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve doc.
parent
22496742
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
28 deletions
+28
-28
real_time_pose.markdown
doc/tutorials/calib3d/real_time_pose/real_time_pose.markdown
+15
-15
table_of_content_calib3d.markdown
doc/tutorials/calib3d/table_of_content_calib3d.markdown
+1
-1
calib3d.hpp
modules/calib3d/include/opencv2/calib3d.hpp
+8
-8
calibration.cpp
modules/calib3d/src/calibration.cpp
+1
-1
fundam.cpp
modules/calib3d/src/fundam.cpp
+1
-1
ptsetreg.cpp
modules/calib3d/src/ptsetreg.cpp
+1
-1
lkpyramid.cpp
modules/video/src/lkpyramid.cpp
+1
-1
No files found.
doc/tutorials/calib3d/real_time_pose/real_time_pose.markdown
View file @
67acfc6e
...
...
@@ -7,7 +7,7 @@ object in the case of computer vision area to do later some 3D rendering or in t
obtain an object pose in order to grasp it and do some manipulation. However, this is not a trivial
problem to solve due to the fact that the most common issue in image processing is the computational
cost of applying a lot of algorithms or mathematical operations for solving a problem which is basic
and immediatel
e
y for humans.
and immediately for humans.
Goal
----
...
...
@@ -63,7 +63,7 @@ The tutorial consists of two main programs:
-#
**Model registration**
This applicaton is exclusive to whom don't have a 3D textured model of the object to be detected.
This applicat
i
on is exclusive to whom don't have a 3D textured model of the object to be detected.
You can use this program to create your own textured 3D model. This program only works for planar
objects, then if you want to model an object with complex shape you should use a sophisticated
software to create it.
...
...
@@ -110,7 +110,7 @@ The tutorial consists of two main programs:
-c, --confidence (value:0.95)
RANSAC confidence
-e, --error (value:2.0)
RANSAC reprojection err
r
or
RANSAC reprojection error
-f, --fast (value:true)
use of robust fast match
-h, --help (value:true)
...
...
@@ -269,7 +269,7 @@ Here is explained in detail the code for the real time application:
Firstly, we have to set which matcher we want to use. In this case is used
@ref cv::FlannBasedMatcher matcher which in terms of computational cost is faster than the
@ref cv::BFMatcher matcher as we increase the trained collect
ct
ion of features. Then, for
@ref cv::BFMatcher matcher as we increase the trained collection of features. Then, for
FlannBased matcher the index created is *Multi-Probe LSH: Efficient Indexing for High-Dimensional
Similarity Search* due to *ORB* descriptors are binary.
...
...
@@ -381,12 +381,12 @@ Here is explained in detail the code for the real time application:
as not, there are false correspondences or also called *outliers*. The [Random Sample
Consensus](http://en.wikipedia.org/wiki/RANSAC) or *Ransac* is a non-deterministic iterative
method which estimate parameters of a mathematical model from observed data producing an
aproximate result as the number of iterations increase. After appyling *Ransac* all the *outliers*
ap
p
roximate result as the number of iterations increase. After appyling *Ransac* all the *outliers*
will be eliminated to then estimate the camera pose with a certain probability to obtain a good
solution.
For the camera pose estimation I have implemented a *class* **PnPProblem**. This *class* has 4
atributes: a given calibration matrix, the rotation matrix, the translation matrix and the
at
t
ributes: a given calibration matrix, the rotation matrix, the translation matrix and the
rotation-translation matrix. The intrinsic calibration parameters of the camera which you are
using to estimate the pose are necessary. In order to obtain the parameters you can check
@ref tutorial_camera_calibration_square_chess and @ref tutorial_camera_calibration tutorials.
...
...
@@ -406,7 +406,7 @@ Here is explained in detail the code for the real time application:
PnPProblem pnp_detection(params_WEBCAM); // instantiate PnPProblem class
@endcode
The following code is how the *PnPProblem class* initialises its atributes:
The following code is how the *PnPProblem class* initialises its at
t
ributes:
@code{.cpp}
// Custom constructor given the intrinsic camera parameters
...
...
@@ -431,13 +431,13 @@ Here is explained in detail the code for the real time application:
surfaces and sometimes the pose estimation seems to have a mirror effect. Therefore, in this this
tutorial is used ITERATIVE method due to the object to be detected has planar surfaces.
The OpenCV R
ansac
implementation wants you to provide three parameters: the maximum number of
The OpenCV R
ANSAC
implementation wants you to provide three parameters: the maximum number of
iterations until stop the algorithm, the maximum allowed distance between the observed and
computed point projections to consider it an inlier and the confidence to obtain a good result.
You can tune these param
a
ters in order to improve your algorithm performance. Increasing the
You can tune these param
e
ters in order to improve your algorithm performance. Increasing the
number of iterations you will have a more accurate solution, but will take more time to find a
solution. Increasing the reprojection error will reduce the computation time, but your solution
will be unaccurate. Decreasing the confidence your a
r
lgorithm will be faster, but the obtained
will be unaccurate. Decreasing the confidence your algorithm will be faster, but the obtained
solution will be unaccurate.
The following parameters work for this application:
...
...
@@ -446,7 +446,7 @@ Here is explained in detail the code for the real time application:
int iterationsCount = 500; // number of Ransac iterations.
float reprojectionError = 2.0; // maximum allowed distance to consider it an inlier.
float confidence = 0.95; //
ransac
successful confidence.
float confidence = 0.95; //
RANSAC
successful confidence.
@endcode
The following code corresponds to the *estimatePoseRANSAC()* function which belongs to the
*PnPProblem class*. This function estimates the rotation and translation matrix given a set of
...
...
@@ -458,7 +458,7 @@ Here is explained in detail the code for the real time application:
void PnPProblem::estimatePoseRANSAC( const std::vector<cv::Point3f> &list_points3d, // list with model 3D coordinates
const std::vector<cv::Point2f> &list_points2d, // list with scene 2D coordinates
int flags, cv::Mat &inliers, int iterationsCount, // PnP method; inliers container
float reprojectionError, float confidence ) // R
ansac
parameters
float reprojectionError, float confidence ) // R
ANSAC
parameters
{
cv::Mat distCoeffs = cv::Mat::zeros(4, 1, CV_64FC1); // vector of distortion coefficients
cv::Mat rvec = cv::Mat::zeros(3, 1, CV_64FC1); // output rotation vector
...
...
@@ -479,8 +479,8 @@ Here is explained in detail the code for the real time application:
}
@endcode
In the following code are the 3th and 4th steps of the main algorithm. The first, calling the
above function and the second taking the output inliers vector from R
ansac
to get the 2D scene
points for drawing purpose. As seen in the code we must be sure to apply R
ansac
if we have
above function and the second taking the output inliers vector from R
ANSAC
to get the 2D scene
points for drawing purpose. As seen in the code we must be sure to apply R
ANSAC
if we have
matches, in the other case, the function @ref cv::solvePnPRansac crashes due to any OpenCV *bug*.
@code{.cpp}
if(good_matches.size() > 0) // None matches, then RANSAC crashes
...
...
@@ -558,7 +558,7 @@ Here is explained in detail the code for the real time application:
\f[X = (x,y,z,\dot x,\dot y,\dot z,\ddot x,\ddot y,\ddot z,\psi,\theta,\phi,\dot \psi,\dot \theta,\dot \phi,\ddot \psi,\ddot \theta,\ddot \phi)^T\f]
Secondly, we have to define the number of measuremnts which will be 6: from \f$R\f$ and \f$t\f$ we can
Secondly, we have to define the number of measurem
e
nts which will be 6: from \f$R\f$ and \f$t\f$ we can
extract \f$(x,y,z)\f$ and \f$(\psi,\theta,\phi)\f$. In addition, we have to define the number of control
actions to apply to the system which in this case will be *zero*. Finally, we have to define the
differential time between measurements which in this case is \f$1/T\f$, where *T* is the frame rate of
...
...
doc/tutorials/calib3d/table_of_content_calib3d.markdown
View file @
67acfc6e
...
...
@@ -37,6 +37,6 @@ Although we get most of our images in a 2D format they do come from a 3D world.
*Author:* Vladislav Sovrasov
Camera calibration by using either the chessboard, chAruco, asymmetrical circle or dual asymmetrical circle
pattern. Calibration process is contin
i
ous, so you can see results after each new pattern shot.
pattern. Calibration process is contin
u
ous, so you can see results after each new pattern shot.
As an output you get average reprojection error, intrinsic camera parameters, distortion coefficients and
confidence intervals for all of evaluated variables.
modules/calib3d/include/opencv2/calib3d.hpp
View file @
67acfc6e
...
...
@@ -396,7 +396,7 @@ and a rotation matrix.
It optionally returns three rotation matrices, one for each axis, and the three Euler angles in
degrees (as the return value) that could be used in OpenGL. Note, there is always more than one
sequence of rotations about the three principal axes that results in the same orientation of an
object, eg. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler ang
u
les
object, eg. see @cite Slabaugh . Returned tree rotation matrices and corresponding three Euler angles
are only one of the possible solutions.
*/
CV_EXPORTS_W
Vec3d
RQDecomp3x3
(
InputArray
src
,
OutputArray
mtxR
,
OutputArray
mtxQ
,
...
...
@@ -583,7 +583,7 @@ projections, as well as the camera matrix and the distortion coefficients.
it as, e.g., imagePoints, one must effectively copy it into a new array: imagePoints =
np.ascontiguousarray(D[:,:2]).reshape((N,1,2))
- The methods **SOLVEPNP_DLS** and **SOLVEPNP_UPNP** cannot be used as the current implementations are
unstable and sometimes give completly wrong results. If you pass one of these two
unstable and sometimes give complet
e
ly wrong results. If you pass one of these two
flags, **SOLVEPNP_EPNP** method will be used instead.
- The minimum number of points is 4. In the case of **SOLVEPNP_P3P** and **SOLVEPNP_AP3P**
methods, it is required to use exactly 4 points (the first 3 points are used to estimate all the solutions
...
...
@@ -1371,9 +1371,9 @@ be floating-point (single or double precision).
@param cameraMatrix Camera matrix \f$K = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ .
Note that this function assumes that points1 and points2 are feature points from cameras with the
same camera matrix.
@param method Method for computing a
fundament
al matrix.
@param method Method for computing a
n essenti
al matrix.
- **RANSAC** for the RANSAC algorithm.
- **MEDS** for the LMedS algorithm.
- **
L
MEDS** for the LMedS algorithm.
@param prob Parameter used for the RANSAC or LMedS methods only. It specifies a desirable level of
confidence (probability) that the estimated matrix is correct.
@param threshold Parameter used for RANSAC. It is the maximum distance from a point to an epipolar
...
...
@@ -1655,7 +1655,7 @@ to 3D points with a very large Z value (currently set to 10000).
depth. ddepth can also be set to CV_16S, CV_32S or CV_32F.
The function transforms a single-channel disparity map to a 3-channel image representing a 3D
surface. That is, for each pixel (x,y) andthe corresponding disparity d=disparity(x,y) , it
surface. That is, for each pixel (x,y) and
the corresponding disparity d=disparity(x,y) , it
computes:
\f[\begin{array}{l} [X \; Y \; Z \; W]^T = \texttt{Q} *[x \; y \; \texttt{disparity} (x,y) \; 1]^T \\ \texttt{\_3dImage} (x,y) = (X/W, \; Y/W, \; Z/W) \end{array}\f]
...
...
@@ -1704,7 +1704,7 @@ CV_EXPORTS_W int estimateAffine3D(InputArray src, InputArray dst,
@param from First input 2D point set.
@param to Second input 2D point set.
@param inliers Output vector indicating which points are inliers.
@param method Robust method used to compute tranformation. The following methods are possible:
@param method Robust method used to compute tran
s
formation. The following methods are possible:
- cv::RANSAC - RANSAC-based robust method
- cv::LMEDS - Least-Median robust method
RANSAC is the default method.
...
...
@@ -1744,7 +1744,7 @@ two 2D point sets.
@param from First input 2D point set.
@param to Second input 2D point set.
@param inliers Output vector indicating which points are inliers.
@param method Robust method used to compute tranformation. The following methods are possible:
@param method Robust method used to compute tran
s
formation. The following methods are possible:
- cv::RANSAC - RANSAC-based robust method
- cv::LMEDS - Least-Median robust method
RANSAC is the default method.
...
...
@@ -2043,7 +2043,7 @@ namespace fisheye
@param alpha The skew coefficient.
@param distorted Output array of image points, 1xN/Nx1 2-channel, or vector\<Point2f\> .
Note that the function assumes the camera matrix of the undistorted points to be i
n
dentity.
Note that the function assumes the camera matrix of the undistorted points to be identity.
This means if you want to transform back points undistorted with undistortPoints() you have to
multiply them with \f$P^{-1}\f$.
*/
...
...
modules/calib3d/src/calibration.cpp
View file @
67acfc6e
...
...
@@ -2997,7 +2997,7 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
eulerAngles
->
z
=
acos
(
_Qz
[
0
][
0
])
*
(
_Qz
[
0
][
1
]
>=
0
?
1
:
-
1
)
*
(
180.0
/
CV_PI
);
}
/* Calulate orthogonal matrix. */
/* Cal
c
ulate orthogonal matrix. */
/*
Q = QzT * QyT * QxT
*/
...
...
modules/calib3d/src/fundam.cpp
View file @
67acfc6e
...
...
@@ -171,7 +171,7 @@ public:
float
ww
=
1.
f
/
(
Hf
[
6
]
*
M
[
i
].
x
+
Hf
[
7
]
*
M
[
i
].
y
+
1.
f
);
float
dx
=
(
Hf
[
0
]
*
M
[
i
].
x
+
Hf
[
1
]
*
M
[
i
].
y
+
Hf
[
2
])
*
ww
-
m
[
i
].
x
;
float
dy
=
(
Hf
[
3
]
*
M
[
i
].
x
+
Hf
[
4
]
*
M
[
i
].
y
+
Hf
[
5
])
*
ww
-
m
[
i
].
y
;
err
[
i
]
=
(
float
)(
dx
*
dx
+
dy
*
dy
)
;
err
[
i
]
=
dx
*
dx
+
dy
*
dy
;
}
}
};
...
...
modules/calib3d/src/ptsetreg.cpp
View file @
67acfc6e
...
...
@@ -594,7 +594,7 @@ public:
bool
checkSubset
(
InputArray
_ms1
,
InputArray
,
int
count
)
const
{
Mat
ms1
=
_ms1
.
getMat
();
// check colinearity and also check that points are too close
// check col
l
inearity and also check that points are too close
// only ms1 affects actual estimation stability
return
!
haveCollinearPoints
(
ms1
,
count
);
}
...
...
modules/video/src/lkpyramid.cpp
View file @
67acfc6e
...
...
@@ -1610,7 +1610,7 @@ cv::Mat cv::estimateRigidTransform( InputArray src1, InputArray src2, bool fullA
Point2f
a
[
RANSAC_SIZE0
];
Point2f
b
[
RANSAC_SIZE0
];
// choose random 3 non-co
m
planar points from A & B
// choose random 3 non-coplanar points from A & B
for
(
i
=
0
;
i
<
RANSAC_SIZE0
;
i
++
)
{
for
(
k1
=
0
;
k1
<
RANSAC_MAX_ITERS
;
k1
++
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment