-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtils.h
executable file
·78 lines (55 loc) · 2.5 KB
/
Utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Utils.h
*
* Created on: Mar 28, 2014
* Author: Edgar Riba
*/
// ETP added to it finds cv::
#include <opencv2/core/core.hpp>
//#include <opencv2/core/utility.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/video/tracking.hpp>
//ETP end
#ifndef UTILS_H_
#define UTILS_H_
#include <iostream>
//#include "PnPProblem.h"
// Draw a text with the question point
void drawQuestion(cv::Mat image, cv::Point3f point, cv::Scalar color);
// Draw a text with the number of entered points
void drawText(cv::Mat image, std::string text, cv::Scalar color);
// Draw a text with the number of entered points
void drawText2(cv::Mat image, std::string text, cv::Scalar color);
// Draw a text with the frame ratio
void drawFPS(cv::Mat image, double fps, cv::Scalar color);
// Draw a text with the frame ratio
void drawConfidence(cv::Mat image, double confidence, cv::Scalar color);
// Draw a text with the number of entered points
void drawCounter(cv::Mat image, int n, int n_max, cv::Scalar color);
// Draw the points and the coordinates
void drawPoints(cv::Mat image, std::vector<cv::Point2f> &list_points_2d, std::vector<cv::Point3f> &list_points_3d, cv::Scalar color);
// Draw only the 2D points
void draw2DPoints(cv::Mat image, std::vector<cv::Point2f> &list_points, cv::Scalar color);
// Draw an arrow into the image
void drawArrow(cv::Mat image, cv::Point2i p, cv::Point2i q, cv::Scalar color, int arrowMagnitude = 9, int thickness=1, int line_type=8, int shift=0);
// Draw the 3D coordinate axes
void draw3DCoordinateAxes(cv::Mat image, const std::vector<cv::Point2f> &list_points2d);
// Draw the object mesh
//void drawObjectMesh(cv::Mat image, const Mesh *mesh, PnPProblem *pnpProblem, cv::Scalar color); ETP commented to avoid importing PnPProblem
// Computes the norm of the translation error
double get_translation_error(const cv::Mat &t_true, const cv::Mat &t);
// Computes the norm of the rotation error
double get_rotation_error(const cv::Mat &R_true, const cv::Mat &R);
// Converts a given Rotation Matrix to Euler angles
cv::Mat rot2euler(const cv::Mat & rotationMatrix);
// Converts a given Euler angles to Rotation Matrix
cv::Mat euler2rot(const cv::Mat & euler);
// Converts a given string to an integer
int StringToInt ( const std::string &Text );
// Converts a given float to a string
std::string FloatToString ( float Number );
// Converts a given integer to a string
std::string IntToString ( int Number );
#endif /* UTILS_H_ */