ViSP  2.10.0
vpConvert.h
1 /****************************************************************************
2  *
3  * $Id: vpIoTools.h 5197 2015-01-23 17:24:22Z strinh $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Directory management.
36  *
37  * Authors:
38  * Fabien Spindler
39  * Souriya Trinh
40  *
41  *****************************************************************************/
42 
43 
44 #ifndef __vpConvert_h__
45 #define __vpConvert_h__
46 
52 #include <visp/vpConfig.h>
53 
54 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
55  #include <opencv2/core/core.hpp>
56  #include <opencv2/features2d/features2d.hpp>
57 #endif
58 
59 #include <visp/vpImagePoint.h>
60 #include <visp/vpPoint.h>
61 
62 
63 class VISP_EXPORT vpConvert
64 {
65 
66 public:
67 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
68  static void convertFromOpenCV(const cv::KeyPoint &from, vpImagePoint &to);
69  static void convertFromOpenCV(const cv::Point2f &from, vpImagePoint &to);
70  static void convertFromOpenCV(const cv::Point2d &from, vpImagePoint &to);
71  static void convertFromOpenCV(const cv::Point3f &from, vpPoint &to, const bool cameraFrame=false);
72  static void convertFromOpenCV(const cv::Point3d &from, vpPoint &to, const bool cameraFrame=false);
73 
74  static void convertFromOpenCV(const std::vector<cv::KeyPoint> &from, std::vector<vpImagePoint> &to);
75  static void convertFromOpenCV(const std::vector<cv::Point2f> &from, std::vector<vpImagePoint> &to);
76  static void convertFromOpenCV(const std::vector<cv::Point2d> &from, std::vector<vpImagePoint> &to);
77  static void convertFromOpenCV(const std::vector<cv::Point3f> &from, std::vector<vpPoint> &to, const bool cameraFrame=false);
78  static void convertFromOpenCV(const std::vector<cv::Point3d> &from, std::vector<vpPoint> &to, const bool cameraFrame=false);
79  static void convertFromOpenCV(const std::vector<cv::DMatch> &from, std::vector<unsigned int> &to);
80 
81  static void convertToOpenCV(const vpImagePoint &from, cv::Point2f &to);
82  static void convertToOpenCV(const vpImagePoint &from, cv::Point2d &to);
83  static void convertToOpenCV(const vpPoint &from, cv::Point3f &to, const bool cameraFrame=false);
84  static void convertToOpenCV(const vpPoint &from, cv::Point3d &to, const bool cameraFrame=false);
85 
86  static void convertToOpenCV(const std::vector<vpImagePoint> &from, std::vector<cv::Point2f> &to);
87  static void convertToOpenCV(const std::vector<vpImagePoint> &from, std::vector<cv::Point2d> &to);
88  static void convertToOpenCV(const std::vector<vpPoint> &from, std::vector<cv::Point3f> &to, const bool cameraFrame=false);
89  static void convertToOpenCV(const std::vector<vpPoint> &from, std::vector<cv::Point3d> &to, const bool cameraFrame=false);
90 
91 private:
92  static vpImagePoint keyPointToVpImagePoint(const cv::KeyPoint &keypoint);
93  static vpImagePoint point2fToVpImagePoint(const cv::Point2f &point);
94  static vpImagePoint point2dToVpImagePoint(const cv::Point2d &point);
95  static vpPoint point3fToVpObjectPoint(const cv::Point3f &point3f);
96  static vpPoint point3dToVpObjectPoint(const cv::Point3d &point3d);
97  static vpPoint point3fToVpCamPoint(const cv::Point3f &point3f);
98  static vpPoint point3dToVpCamPoint(const cv::Point3d &point3d);
99  static int dMatchToTrainIndex(const cv::DMatch &match);
100 
101  static cv::Point2f vpImagePointToPoint2f(const vpImagePoint &point);
102  static cv::Point2d vpImagePointToPoint2d(const vpImagePoint &point);
103  static cv::Point3f vpCamPointToPoint3f(const vpPoint &point);
104  static cv::Point3d vpCamPointToPoint3d(const vpPoint &point);
105  static cv::Point3f vpObjectPointToPoint3f(const vpPoint &point);
106  static cv::Point3d vpObjectPointToPoint3d(const vpPoint &point);
107 
108 #endif
109 
110 };
111 
112 #endif
Class that defines what is a point.
Definition: vpPoint.h:65
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:93