提交 c7f6c0cb 编写于 作者: E edgarriba

Fixed warnings + RANSAC confidence to double

上级 213241c0
......@@ -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
......
......@@ -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.
......
......@@ -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)
{
......
......@@ -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++;
......
......@@ -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();
}
......@@ -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;
}
......
......@@ -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; }
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册