Skip to content

Commit

Permalink
avoid passing std::vector to/from cv::projectPoints
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed May 11, 2017
1 parent d2b4dcb commit 5ecbf59
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions image_geometry/src/pinhole_camera_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,18 @@ cv::Point2d PinholeCameraModel::unrectifyPoint(const cv::Point2d& uv_rect) const
cv::Mat r_vec, t_vec = cv::Mat_<double>::zeros(3, 1);
cv::Rodrigues(R_.t(), r_vec);
std::vector<cv::Point2d> image_point;
cv::projectPoints(std::vector<cv::Point3d>(1, ray), r_vec, t_vec, K_, D_, image_point);

return image_point[0];
// passing std::vector<..> to / from cv::projectPoints
// seems to not work on Windows in Debug mode with VS 2015
cv::Mat mat_in(1, 3, CV_64F);
mat_in.at<double>(0, 0) = ray.x;
mat_in.at<double>(0, 1) = ray.y;
mat_in.at<double>(0, 2) = ray.z;
cv::Mat mat_out(1, 1, CV_64F);

cv::projectPoints(mat_in, r_vec, t_vec, K_, D_, mat_out);

return cv::Point2d(mat_out.at<double>(0, 0), mat_out.at<double>(0, 1));
}

cv::Rect PinholeCameraModel::rectifyRoi(const cv::Rect& roi_raw) const
Expand Down

0 comments on commit 5ecbf59

Please sign in to comment.