calibration_pattern.cpp
Go to the documentation of this file.
2 
4 
5 template <typename MessageType>
7 {
8  thickness = node[itmThickness].asDouble() / ensenso_conversion::conversionFactor;
9  gridSpacing = node[itmGridSpacing].asDouble() / ensenso_conversion::conversionFactor;
10  gridSizeX = node[itmGridSize][0].asInt();
11  gridSizeY = node[itmGridSize][1].asInt();
12 }
13 
14 template <typename MessageType>
16 {
17  thickness = message.thickness;
18  gridSpacing = message.grid_spacing;
19  gridSizeX = message.grid_size_x;
20  gridSizeY = message.grid_size_y;
21 }
22 
23 template <typename MessageType>
25 {
26  thickness = message.thickness;
27  gridSpacing = message.grid_spacing;
28  gridSizeX = message.grid_size_x;
29  gridSizeY = message.grid_size_y;
30 }
31 
32 template <typename MessageType>
34 {
35  message.thickness = thickness;
36  message.grid_spacing = gridSpacing;
37  message.grid_size_x = gridSizeX;
38  message.grid_size_y = gridSizeY;
39 }
40 
41 template <typename MessageType>
43 {
44  node[itmPattern][itmThickness] = thickness * ensenso_conversion::conversionFactor;
45  node[itmPattern][itmGridSpacing] = gridSpacing * ensenso_conversion::conversionFactor;
46  node[itmPattern][itmGridSize][0] = gridSizeX;
47  node[itmPattern][itmGridSize][1] = gridSizeY;
48 }
49 
50 template <typename MessageType>
52 {
53  MessageType rosMsg;
54  rosMsg.grid_size_x = gridSizeX;
55  rosMsg.grid_size_y = gridSizeY;
56  rosMsg.grid_spacing = gridSpacing;
57  rosMsg.thickness = thickness;
58  return rosMsg;
59 }
60 
62 {
63 }
64 
65 MonoCalibrationPattern::MonoCalibrationPattern(ensenso_camera_msgs::MonoCalibrationPattern const& message)
66  : CalibrationPattern(message)
67 {
68  readFromMessage(message);
69 }
70 
71 void MonoCalibrationPattern::readFromMessage(ensenso_camera_msgs::MonoCalibrationPattern const& message)
72 {
73  points.clear();
74  points.insert(points.begin(), message.points.begin(), message.points.end());
75 }
76 
77 void MonoCalibrationPattern::writeToMessage(ensenso_camera_msgs::MonoCalibrationPattern& message)
78 {
80 
81  message.points.clear();
82  message.points.insert(message.points.begin(), points.begin(), points.end());
83 }
84 
85 void MonoCalibrationPattern::writeToNxLib(NxLibItem const& node)
86 {
88  for (size_t i = 0; i < points.size(); i++)
89  {
90  node[itmPoints][i][0] = points[i].x;
91  node[itmPoints][i][1] = points[i].y;
92  }
93 }
94 
95 ensenso_camera_msgs::MonoCalibrationPattern MonoCalibrationPattern::toRosMsg() const
96 {
97  ensenso_camera_msgs::MonoCalibrationPattern rosMonoPattern = CalibrationPattern::toRosMessage();
98 
99  for (auto const& point : points)
100  {
101  rosMonoPattern.points.push_back(point);
102  }
103 
104  return rosMonoPattern;
105 }
106 
107 void StereoCalibrationPattern::writeToMessage(ensenso_camera_msgs::StereoCalibrationPattern& message) const
108 {
109  message = toRosMsg();
110 }
111 
112 void StereoCalibrationPattern::readFromMessage(ensenso_camera_msgs::StereoCalibrationPattern const& message)
113 {
114  leftPoints.clear();
115  leftPoints.insert(leftPoints.begin(), message.left_points.begin(), message.left_points.end());
116  rightPoints.clear();
117  rightPoints.insert(rightPoints.begin(), message.right_points.begin(), message.right_points.end());
118 }
119 
120 void StereoCalibrationPattern::writeToNxLib(NxLibItem const& node, bool right)
121 {
123  auto& points = leftPoints;
124  if (right)
125  {
126  points = rightPoints;
127  }
128 
129  for (size_t i = 0; i < points.size(); i++)
130  {
131  node[itmPoints][i][0] = points[i].x;
132  node[itmPoints][i][1] = points[i].y;
133  }
134 }
135 
137 {
138 }
139 
140 StereoCalibrationPattern::StereoCalibrationPattern(ensenso_camera_msgs::StereoCalibrationPattern const& message)
141  : CalibrationPattern(message)
142 {
143  readFromMessage(message);
144 }
145 
146 ensenso_camera_msgs::StereoCalibrationPattern StereoCalibrationPattern::toRosMsg() const
147 {
148  ensenso_camera_msgs::StereoCalibrationPattern rosStereoPattern = CalibrationPattern::toRosMessage();
149 
150  for (auto const& point : leftPoints)
151  {
152  rosStereoPattern.left_points.push_back(point);
153  }
154  for (auto const& point : rightPoints)
155  {
156  rosStereoPattern.right_points.push_back(point);
157  }
158 
159  return rosStereoPattern;
160 }
void writeToNxLib(NxLibItem const &node, bool right=false)
ensenso_camera_msgs::StereoCalibrationPattern toRosMsg() const
StereoCalibrationPattern(NxLibItem const &node)
CalibrationPattern(MessageType const &message)
MessageType toRosMessage() const
void writeToMessage(ensenso_camera_msgs::MonoCalibrationPattern &message)
void readFromMessage(ensenso_camera_msgs::MonoCalibrationPattern const &message)
std::vector< ensenso_camera_msgs::ImagePoint > leftPoints
MonoCalibrationPattern(NxLibItem const &node)
std::vector< ensenso_camera_msgs::ImagePoint > rightPoints
std::vector< ensenso_camera_msgs::ImagePoint > points
const int conversionFactor
Definition: conversion.h:11
void writeToNxLib(NxLibItem const &node)
void readFromMessage(ensenso_camera_msgs::StereoCalibrationPattern const &message)
void writeMetaDataToNxLib(NxLibItem const &node)
ensenso_camera_msgs::MonoCalibrationPattern toRosMsg() const
void writeMetaDataToMessage(MessageType &message)
void readMetaDataFromMessage(MessageType const &message)
void writeToMessage(ensenso_camera_msgs::StereoCalibrationPattern &message) const


ensenso_camera
Author(s): Ensenso
autogenerated on Sat Jul 27 2019 03:51:24