51 #include <visp/vpConvert.h>
54 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
61 vpImagePoint vpConvert::keyPointToVpImagePoint(
const cv::KeyPoint &keypoint) {
71 vpImagePoint vpConvert::point2fToVpImagePoint(
const cv::Point2f &point) {
81 vpImagePoint vpConvert::point2dToVpImagePoint(
const cv::Point2d &point) {
90 vpPoint vpConvert::point3fToVpObjectPoint(
const cv::Point3f &point3f) {
104 vpPoint vpConvert::point3fToVpCamPoint(
const cv::Point3f &point3f) {
118 vpPoint vpConvert::point3dToVpObjectPoint(
const cv::Point3d &point3d) {
132 vpPoint vpConvert::point3dToVpCamPoint(
const cv::Point3d &point3d) {
147 cv::Point2f vpConvert::vpImagePointToPoint2f(
const vpImagePoint &point) {
148 return cv::Point2f((
float) point.
get_u(), (float) point.
get_v());
157 cv::Point2d vpConvert::vpImagePointToPoint2d(
const vpImagePoint &point) {
158 return cv::Point2d(point.
get_u(), point.
get_v());
167 cv::Point3f vpConvert::vpCamPointToPoint3f(
const vpPoint &point) {
168 return cv::Point3f((
float) point.
get_X(), (float) point.
get_Y(), (float) point.
get_Z());
177 cv::Point3d vpConvert::vpCamPointToPoint3d(
const vpPoint &point) {
187 cv::Point3f vpConvert::vpObjectPointToPoint3f(
const vpPoint &point) {
188 return cv::Point3f((
float) point.
get_oX(), (float) point.
get_oY(), (float) point.
get_oZ());
197 cv::Point3d vpConvert::vpObjectPointToPoint3d(
const vpPoint &point) {
207 int vpConvert::dMatchToTrainIndex(
const cv::DMatch &match) {
208 return match.trainIdx;
218 to = keyPointToVpImagePoint(from);
227 to = point2fToVpImagePoint(from);
236 to = point2dToVpImagePoint(from);
247 to = point3fToVpCamPoint(from);
249 to = point3fToVpObjectPoint(from);
261 to = point3dToVpCamPoint(from);
263 to = point3dToVpObjectPoint(from);
273 to.resize(from.size());
274 std::transform(from.begin(), from.end(), to.begin(), keyPointToVpImagePoint);
283 to.resize(from.size());
284 std::transform(from.begin(), from.end(), to.begin(), point2fToVpImagePoint);
293 to.resize(from.size());
294 std::transform(from.begin(), from.end(), to.begin(), point2dToVpImagePoint);
304 to.resize(from.size());
306 std::transform(from.begin(), from.end(), to.begin(), point3fToVpCamPoint);
308 std::transform(from.begin(), from.end(), to.begin(), point3fToVpObjectPoint);
319 to.resize(from.size());
321 std::transform(from.begin(), from.end(), to.begin(), point3dToVpCamPoint);
323 std::transform(from.begin(), from.end(), to.begin(), point3dToVpObjectPoint);
336 to.resize(from.size());
337 std::transform(from.begin(), from.end(), to.begin(), dMatchToTrainIndex);
346 to = vpImagePointToPoint2f(from);
355 to = vpImagePointToPoint2d(from);
366 to = vpCamPointToPoint3f(from);
368 to = vpObjectPointToPoint3f(from);
380 to = vpCamPointToPoint3d(from);
382 to = vpObjectPointToPoint3d(from);
392 to.resize(from.size());
393 std::transform(from.begin(), from.end(), to.begin(), vpImagePointToPoint2f);
402 to.resize(from.size());
403 std::transform(from.begin(), from.end(), to.begin(), vpImagePointToPoint2d);
413 to.resize(from.size());
415 std::transform(from.begin(), from.end(), to.begin(), vpCamPointToPoint3f);
417 std::transform(from.begin(), from.end(), to.begin(), vpObjectPointToPoint3f);
428 to.resize(from.size());
430 std::transform(from.begin(), from.end(), to.begin(), vpCamPointToPoint3d);
432 std::transform(from.begin(), from.end(), to.begin(), vpObjectPointToPoint3d);
double get_oY() const
Get the point Y coordinate in the object frame.
void set_X(const double X)
Set the point X coordinate in the camera frame.
void set_oX(const double X)
Set the point X coordinate in the object frame.
Class that defines what is a point.
static void convertToOpenCV(const vpImagePoint &from, cv::Point2f &to)
void set_Z(const double Z)
Set the point Z coordinate in the camera frame.
void set_oZ(const double Z)
Set the point Z coordinate in the object frame.
void set_W(const double W)
Set the point W coordinate in the camera frame.
double get_oZ() const
Get the point Z coordinate in the object frame.
void set_oW(const double W)
Set the point W coordinate in the object frame.
void set_Y(const double Y)
Set the point Y coordinate in the camera frame.
double get_Y() const
Get the point Y coordinate in the camera frame.
double get_Z() const
Get the point Z coordinate in the camera frame.
double get_oX() const
Get the point X coordinate in the object frame.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
double get_X() const
Get the point X coordinate in the camera frame.
static void convertFromOpenCV(const cv::KeyPoint &from, vpImagePoint &to)
void set_oY(const double Y)
Set the point Y coordinate in the object frame.