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
c7f6c0cb
Commit
c7f6c0cb
authored
Aug 11, 2014
by
edgarriba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed warnings + RANSAC confidence to double
parent
213241c0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
22 additions
and
22 deletions
+22
-22
camera_calibration_and_3d_reconstruction.rst
.../calib3d/doc/camera_calibration_and_3d_reconstruction.rst
+1
-1
calib3d.hpp
modules/calib3d/include/opencv2/calib3d.hpp
+1
-1
solvepnp.cpp
modules/calib3d/src/solvepnp.cpp
+1
-1
CsvReader.cpp
..._code/calib3d/real_time_pose_estimation/src/CsvReader.cpp
+3
-3
Mesh.cpp
...orial_code/calib3d/real_time_pose_estimation/src/Mesh.cpp
+2
-2
PnPProblem.cpp
...code/calib3d/real_time_pose_estimation/src/PnPProblem.cpp
+5
-5
PnPProblem.h
...l_code/calib3d/real_time_pose_estimation/src/PnPProblem.h
+1
-1
Utils.cpp
...rial_code/calib3d/real_time_pose_estimation/src/Utils.cpp
+1
-1
main_detection.cpp
.../calib3d/real_time_pose_estimation/src/main_detection.cpp
+4
-4
main_registration.cpp
...lib3d/real_time_pose_estimation/src/main_registration.cpp
+3
-3
No files found.
modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst
View file @
c7f6c0cb
...
...
@@ -599,7 +599,7 @@ solvePnPRansac
------------------
Finds an object pose from 3D-2D point correspondences using the RANSAC scheme.
.. ocv:function:: bool solvePnPRansac( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false, int iterationsCount = 100, float reprojectionError = 8.0,
float
confidence = 0.99, OutputArray inliers = noArray(), int flags = ITERATIVE )
.. ocv:function:: bool solvePnPRansac( InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess=false, int iterationsCount = 100, float reprojectionError = 8.0,
double
confidence = 0.99, OutputArray inliers = noArray(), int flags = ITERATIVE )
.. ocv:pyfunction:: cv2.solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs[, rvec[, tvec[, useExtrinsicGuess[, iterationsCount[, reprojectionError[, minInliersCount[, inliers[, flags]]]]]]]]) -> rvec, tvec, inliers
...
...
modules/calib3d/include/opencv2/calib3d.hpp
View file @
c7f6c0cb
...
...
@@ -159,7 +159,7 @@ CV_EXPORTS_W bool solvePnPRansac( InputArray objectPoints, InputArray imagePoint
InputArray
cameraMatrix
,
InputArray
distCoeffs
,
OutputArray
rvec
,
OutputArray
tvec
,
bool
useExtrinsicGuess
=
false
,
int
iterationsCount
=
100
,
float
reprojectionError
=
8.0
,
float
confidence
=
0.99
,
float
reprojectionError
=
8.0
,
double
confidence
=
0.99
,
OutputArray
inliers
=
noArray
(),
int
flags
=
ITERATIVE
);
//! initializes camera matrix from a few 3D points and the corresponding projections.
...
...
modules/calib3d/src/solvepnp.cpp
View file @
c7f6c0cb
...
...
@@ -177,7 +177,7 @@ public:
bool
cv
::
solvePnPRansac
(
InputArray
_opoints
,
InputArray
_ipoints
,
InputArray
_cameraMatrix
,
InputArray
_distCoeffs
,
OutputArray
_rvec
,
OutputArray
_tvec
,
bool
useExtrinsicGuess
,
int
iterationsCount
,
float
reprojectionError
,
float
confidence
,
int
iterationsCount
,
float
reprojectionError
,
double
confidence
,
OutputArray
_inliers
,
int
flags
)
{
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/CsvReader.cpp
View file @
c7f6c0cb
...
...
@@ -45,9 +45,9 @@ void CsvReader::readPLY(vector<Point3f> &list_vertex, vector<vector<int> > &list
getline
(
liness
,
z
);
cv
::
Point3f
tmp_p
;
tmp_p
.
x
=
StringToInt
(
x
);
tmp_p
.
y
=
StringToInt
(
y
);
tmp_p
.
z
=
StringToInt
(
z
);
tmp_p
.
x
=
(
float
)
StringToInt
(
x
);
tmp_p
.
y
=
(
float
)
StringToInt
(
y
);
tmp_p
.
z
=
(
float
)
StringToInt
(
z
);
list_vertex
.
push_back
(
tmp_p
);
count
++
;
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Mesh.cpp
View file @
c7f6c0cb
...
...
@@ -76,7 +76,7 @@ void Mesh::load(const std::string path)
csvReader
.
readPLY
(
list_vertex_
,
list_triangles_
);
// Update mesh attributes
num_vertexs_
=
list_vertex_
.
size
();
num_triangles_
=
list_triangles_
.
size
();
num_vertexs_
=
(
int
)
list_vertex_
.
size
();
num_triangles_
=
(
int
)
list_triangles_
.
size
();
}
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/PnPProblem.cpp
View file @
c7f6c0cb
...
...
@@ -133,9 +133,9 @@ bool PnPProblem::estimatePose( const std::vector<cv::Point3f> &list_points3d,
// Estimate the pose given a list of 2D/3D correspondences with RANSAC and the method to use
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
)
// Ransac parameters
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
,
double
confidence
)
// Ransac 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
...
...
@@ -187,8 +187,8 @@ cv::Point2f PnPProblem::backproject3DPoint(const cv::Point3f &point3d)
// Normalization of [u v]'
cv
::
Point2f
point2d
;
point2d
.
x
=
point2d_vec
.
at
<
double
>
(
0
)
/
point2d_vec
.
at
<
double
>
(
2
);
point2d
.
y
=
point2d_vec
.
at
<
double
>
(
1
)
/
point2d_vec
.
at
<
double
>
(
2
);
point2d
.
x
=
(
float
)(
point2d_vec
.
at
<
double
>
(
0
)
/
point2d_vec
.
at
<
double
>
(
2
)
);
point2d
.
y
=
(
float
)(
point2d_vec
.
at
<
double
>
(
1
)
/
point2d_vec
.
at
<
double
>
(
2
)
);
return
point2d
;
}
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/PnPProblem.h
View file @
c7f6c0cb
...
...
@@ -30,7 +30,7 @@ public:
bool
estimatePose
(
const
std
::
vector
<
cv
::
Point3f
>
&
list_points3d
,
const
std
::
vector
<
cv
::
Point2f
>
&
list_points2d
,
int
flags
);
void
estimatePoseRANSAC
(
const
std
::
vector
<
cv
::
Point3f
>
&
list_points3d
,
const
std
::
vector
<
cv
::
Point2f
>
&
list_points2d
,
int
flags
,
cv
::
Mat
&
inliers
,
int
iterationsCount
,
float
reprojectionError
,
float
confidence
);
int
iterationsCount
,
float
reprojectionError
,
double
confidence
);
cv
::
Mat
get_A_matrix
()
const
{
return
_A_matrix
;
}
cv
::
Mat
get_R_matrix
()
const
{
return
_R_matrix
;
}
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp
View file @
c7f6c0cb
...
...
@@ -19,7 +19,7 @@
// For text
int
fontFace
=
cv
::
FONT_ITALIC
;
double
fontScale
=
0.75
;
double
thickness_font
=
2
;
int
thickness_font
=
2
;
// For circles
int
lineType
=
8
;
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp
View file @
c7f6c0cb
...
...
@@ -49,7 +49,7 @@ bool fast_match = true; // fastRobustMatch() or robustMatch()
// RANSAC parameters
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.
double
confidence
=
0.95
;
// ransac successful confidence.
// Kalman Filter parameters
int
minInliersKalman
=
30
;
// Kalman threshold updating
...
...
@@ -287,7 +287,7 @@ int main(int argc, char *argv[])
drawObjectMesh
(
frame_vis
,
&
mesh
,
&
pnp_detection_est
,
yellow
);
// draw estimated pose
}
double
l
=
5
;
float
l
=
5
;
std
::
vector
<
cv
::
Point2f
>
pose_points2d
;
pose_points2d
.
push_back
(
pnp_detection_est
.
backproject3DPoint
(
cv
::
Point3f
(
0
,
0
,
0
)));
// axis center
pose_points2d
.
push_back
(
pnp_detection_est
.
backproject3DPoint
(
cv
::
Point3f
(
l
,
0
,
0
)));
// axis x
...
...
@@ -315,10 +315,10 @@ int main(int argc, char *argv[])
// Draw some debug text
int
inliers_int
=
inliers_idx
.
rows
;
int
outliers_int
=
good_matches
.
size
()
-
inliers_int
;
int
outliers_int
=
(
int
)
good_matches
.
size
()
-
inliers_int
;
std
::
string
inliers_str
=
IntToString
(
inliers_int
);
std
::
string
outliers_str
=
IntToString
(
outliers_int
);
std
::
string
n
=
IntToString
(
good_matches
.
size
());
std
::
string
n
=
IntToString
(
(
int
)
good_matches
.
size
());
std
::
string
text
=
"Found "
+
inliers_str
+
" of "
+
n
+
" matches"
;
std
::
string
text2
=
"Inliers: "
+
inliers_str
+
" - Outliers: "
+
outliers_str
;
...
...
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_registration.cpp
View file @
c7f6c0cb
...
...
@@ -67,7 +67,7 @@ static void onMouseModelRegistration( int event, int x, int y, int, void* )
int
n_regist
=
registration
.
getNumRegist
();
int
n_vertex
=
pts
[
n_regist
];
cv
::
Point2f
point_2d
=
cv
::
Point2f
(
x
,
y
);
cv
::
Point2f
point_2d
=
cv
::
Point2f
(
(
float
)
x
,(
float
)
y
);
cv
::
Point3f
point_3d
=
mesh
.
getVertex
(
n_vertex
-
1
);
bool
is_registrable
=
registration
.
is_registrable
();
...
...
@@ -224,12 +224,12 @@ int main()
std
::
vector
<
cv
::
Point2f
>
list_points_out
=
model
.
get_points2d_out
();
// Draw some debug text
std
::
string
num
=
IntToString
(
list_points_in
.
size
());
std
::
string
num
=
IntToString
(
(
int
)
list_points_in
.
size
());
std
::
string
text
=
"There are "
+
num
+
" inliers"
;
drawText
(
img_vis
,
text
,
green
);
// Draw some debug text
num
=
IntToString
(
list_points_out
.
size
());
num
=
IntToString
(
(
int
)
list_points_out
.
size
());
text
=
"There are "
+
num
+
" outliers"
;
drawText2
(
img_vis
,
text
,
red
);
...
...
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