comparison trajectorymanagement/src/PointOperations.h @ 1159:e1e7acef8eab

moved trajectory management library into Traffic Intelligence
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Mon, 22 Feb 2021 22:09:35 -0500
parents
children
comparison
equal deleted inserted replaced
1158:7eb972942f22 1159:e1e7acef8eab
1 #ifndef POINTOPERATIONS_H_
2 #define POINTOPERATIONS_H_
3
4 #include "opencv2/core/core.hpp"
5
6 template<typename Ti, typename Tr>
7 std::basic_istream<Ti>& operator>>(std::basic_istream<Ti>& in, cv::Point_<Tr>& point)
8 {
9 Tr x, y;
10 if (in >> x >> y)
11 {
12 point.x = x;
13 point.y = y;
14 }
15 return in;
16 }
17
18 template<typename Ti, typename Tr>
19 std::basic_istream<Ti>& operator>>(std::basic_istream<Ti>& in, cv::Point3_<Tr>& point)
20 {
21 Tr x, y, z;
22 if (in >> x >> y >> z)
23 {
24 point.x = x;
25 point.y = y;
26 point.z = z;
27 }
28 return in;
29 }
30
31
32 template<typename Tr>
33 inline std::ostringstream& operator<<(std::ostringstream& out, const cv::Point_<Tr>& point)
34 {
35 out << point.x << " " << point.y;
36 return out;
37 }
38
39 template<typename Tr>
40 inline std::ostringstream& operator<<(std::ostringstream& out, const cv::Point3_<Tr>& point)
41 {
42 out << point.x << " " << point.y << " " << point.z;
43 return out;
44 }
45
46 #endif /* POINTOPERATIONS_H_ */