YARP
Yet Another Robot Platform
SetCameraInfo.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6// This is an automatically generated file.
7
8// Generated from the following "sensor_msgs/SetCameraInfo" msg definition:
9// # This service requests that a camera stores the given CameraInfo
10// # as that camera's calibration information.
11// #
12// # The width and height in the camera_info field should match what the
13// # camera is currently outputting on its camera_info topic, and the camera
14// # will assume that the region of the imager that is being referred to is
15// # the region that the camera is currently capturing.
16//
17// sensor_msgs/CameraInfo camera_info # The camera_info to store
18// ---
19// bool success # True if the call succeeded
20// string status_message # Used to give details about success
21// Instances of this class can be read and written with YARP ports,
22// using a ROS-compatible format.
23
24#ifndef YARP_ROSMSG_sensor_msgs_SetCameraInfo_h
25#define YARP_ROSMSG_sensor_msgs_SetCameraInfo_h
26
27#include <yarp/os/Wire.h>
28#include <yarp/os/Type.h>
30#include <string>
31#include <vector>
33
34namespace yarp {
35namespace rosmsg {
36namespace sensor_msgs {
37
39{
40public:
42
44 camera_info()
45 {
46 }
47
48 void clear()
49 {
50 // *** camera_info ***
51 camera_info.clear();
52 }
53
54 bool readBare(yarp::os::ConnectionReader& connection) override
55 {
56 // *** camera_info ***
57 if (!camera_info.read(connection)) {
58 return false;
59 }
60
61 return !connection.isError();
62 }
63
64 bool readBottle(yarp::os::ConnectionReader& connection) override
65 {
66 connection.convertTextMode();
67 yarp::os::idl::WireReader reader(connection);
68 if (!reader.readListHeader(1)) {
69 return false;
70 }
71
72 // *** camera_info ***
73 if (!camera_info.read(connection)) {
74 return false;
75 }
76
77 return !connection.isError();
78 }
79
81 bool read(yarp::os::ConnectionReader& connection) override
82 {
83 return (connection.isBareMode() ? readBare(connection)
84 : readBottle(connection));
85 }
86
87 bool writeBare(yarp::os::ConnectionWriter& connection) const override
88 {
89 // *** camera_info ***
90 if (!camera_info.write(connection)) {
91 return false;
92 }
93
94 return !connection.isError();
95 }
96
97 bool writeBottle(yarp::os::ConnectionWriter& connection) const override
98 {
99 connection.appendInt32(BOTTLE_TAG_LIST);
100 connection.appendInt32(1);
101
102 // *** camera_info ***
103 if (!camera_info.write(connection)) {
104 return false;
105 }
106
107 connection.convertTextMode();
108 return !connection.isError();
109 }
110
112 bool write(yarp::os::ConnectionWriter& connection) const override
113 {
114 return (connection.isBareMode() ? writeBare(connection)
115 : writeBottle(connection));
116 }
117
118 // This class will serialize ROS style or YARP style depending on protocol.
119 // If you need to force a serialization style, use one of these classes:
122
123 // The name for this message, ROS will need this
124 static constexpr const char* typeName = "sensor_msgs/SetCameraInfo";
125
126 // The checksum for this message, ROS will need this
127 static constexpr const char* typeChecksum = "ee34be01fdeee563d0d99cd594d5581d";
128
129 // The source text for this message, ROS will need this
130 static constexpr const char* typeText = "\
131# This service requests that a camera stores the given CameraInfo \n\
132# as that camera's calibration information.\n\
133#\n\
134# The width and height in the camera_info field should match what the\n\
135# camera is currently outputting on its camera_info topic, and the camera\n\
136# will assume that the region of the imager that is being referred to is\n\
137# the region that the camera is currently capturing.\n\
138\n\
139sensor_msgs/CameraInfo camera_info # The camera_info to store\n\
140---\n\
141bool success # True if the call succeeded\n\
142string status_message # Used to give details about success\n\
143\n\
144================================================================================\n\
145MSG: sensor_msgs/CameraInfo\n\
146# This message defines meta information for a camera. It should be in a\n\
147# camera namespace on topic \"camera_info\" and accompanied by up to five\n\
148# image topics named:\n\
149#\n\
150# image_raw - raw data from the camera driver, possibly Bayer encoded\n\
151# image - monochrome, distorted\n\
152# image_color - color, distorted\n\
153# image_rect - monochrome, rectified\n\
154# image_rect_color - color, rectified\n\
155#\n\
156# The image_pipeline contains packages (image_proc, stereo_image_proc)\n\
157# for producing the four processed image topics from image_raw and\n\
158# camera_info. The meaning of the camera parameters are described in\n\
159# detail at http://www.ros.org/wiki/image_pipeline/CameraInfo.\n\
160#\n\
161# The image_geometry package provides a user-friendly interface to\n\
162# common operations using this meta information. If you want to, e.g.,\n\
163# project a 3d point into image coordinates, we strongly recommend\n\
164# using image_geometry.\n\
165#\n\
166# If the camera is uncalibrated, the matrices D, K, R, P should be left\n\
167# zeroed out. In particular, clients may assume that K[0] == 0.0\n\
168# indicates an uncalibrated camera.\n\
169\n\
170#######################################################################\n\
171# Image acquisition info #\n\
172#######################################################################\n\
173\n\
174# Time of image acquisition, camera coordinate frame ID\n\
175Header header # Header timestamp should be acquisition time of image\n\
176 # Header frame_id should be optical frame of camera\n\
177 # origin of frame should be optical center of camera\n\
178 # +x should point to the right in the image\n\
179 # +y should point down in the image\n\
180 # +z should point into the plane of the image\n\
181\n\
182\n\
183#######################################################################\n\
184# Calibration Parameters #\n\
185#######################################################################\n\
186# These are fixed during camera calibration. Their values will be the #\n\
187# same in all messages until the camera is recalibrated. Note that #\n\
188# self-calibrating systems may \"recalibrate\" frequently. #\n\
189# #\n\
190# The internal parameters can be used to warp a raw (distorted) image #\n\
191# to: #\n\
192# 1. An undistorted image (requires D and K) #\n\
193# 2. A rectified image (requires D, K, R) #\n\
194# The projection matrix P projects 3D points into the rectified image.#\n\
195#######################################################################\n\
196\n\
197# The image dimensions with which the camera was calibrated. Normally\n\
198# this will be the full camera resolution in pixels.\n\
199uint32 height\n\
200uint32 width\n\
201\n\
202# The distortion model used. Supported models are listed in\n\
203# sensor_msgs/distortion_models.h. For most cameras, \"plumb_bob\" - a\n\
204# simple model of radial and tangential distortion - is sufficient.\n\
205string distortion_model\n\
206\n\
207# The distortion parameters, size depending on the distortion model.\n\
208# For \"plumb_bob\", the 5 parameters are: (k1, k2, t1, t2, k3).\n\
209float64[] D\n\
210\n\
211# Intrinsic camera matrix for the raw (distorted) images.\n\
212# [fx 0 cx]\n\
213# K = [ 0 fy cy]\n\
214# [ 0 0 1]\n\
215# Projects 3D points in the camera coordinate frame to 2D pixel\n\
216# coordinates using the focal lengths (fx, fy) and principal point\n\
217# (cx, cy).\n\
218float64[9] K # 3x3 row-major matrix\n\
219\n\
220# Rectification matrix (stereo cameras only)\n\
221# A rotation matrix aligning the camera coordinate system to the ideal\n\
222# stereo image plane so that epipolar lines in both stereo images are\n\
223# parallel.\n\
224float64[9] R # 3x3 row-major matrix\n\
225\n\
226# Projection/camera matrix\n\
227# [fx' 0 cx' Tx]\n\
228# P = [ 0 fy' cy' Ty]\n\
229# [ 0 0 1 0]\n\
230# By convention, this matrix specifies the intrinsic (camera) matrix\n\
231# of the processed (rectified) image. That is, the left 3x3 portion\n\
232# is the normal camera intrinsic matrix for the rectified image.\n\
233# It projects 3D points in the camera coordinate frame to 2D pixel\n\
234# coordinates using the focal lengths (fx', fy') and principal point\n\
235# (cx', cy') - these may differ from the values in K.\n\
236# For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will\n\
237# also have R = the identity and P[1:3,1:3] = K.\n\
238# For a stereo pair, the fourth column [Tx Ty 0]' is related to the\n\
239# position of the optical center of the second camera in the first\n\
240# camera's frame. We assume Tz = 0 so both cameras are in the same\n\
241# stereo image plane. The first camera always has Tx = Ty = 0. For\n\
242# the right (second) camera of a horizontal stereo pair, Ty = 0 and\n\
243# Tx = -fx' * B, where B is the baseline between the cameras.\n\
244# Given a 3D point [X Y Z]', the projection (x, y) of the point onto\n\
245# the rectified image is given by:\n\
246# [u v w]' = P * [X Y Z 1]'\n\
247# x = u / w\n\
248# y = v / w\n\
249# This holds for both images of a stereo pair.\n\
250float64[12] P # 3x4 row-major matrix\n\
251\n\
252\n\
253#######################################################################\n\
254# Operational Parameters #\n\
255#######################################################################\n\
256# These define the image region actually captured by the camera #\n\
257# driver. Although they affect the geometry of the output image, they #\n\
258# may be changed freely without recalibrating the camera. #\n\
259#######################################################################\n\
260\n\
261# Binning refers here to any camera setting which combines rectangular\n\
262# neighborhoods of pixels into larger \"super-pixels.\" It reduces the\n\
263# resolution of the output image to\n\
264# (width / binning_x) x (height / binning_y).\n\
265# The default values binning_x = binning_y = 0 is considered the same\n\
266# as binning_x = binning_y = 1 (no subsampling).\n\
267uint32 binning_x\n\
268uint32 binning_y\n\
269\n\
270# Region of interest (subwindow of full camera resolution), given in\n\
271# full resolution (unbinned) image coordinates. A particular ROI\n\
272# always denotes the same window of pixels on the camera sensor,\n\
273# regardless of binning settings.\n\
274# The default setting of roi (all values 0) is considered the same as\n\
275# full resolution (roi.width = width, roi.height = height).\n\
276RegionOfInterest roi\n\
277\n\
278================================================================================\n\
279MSG: std_msgs/Header\n\
280# Standard metadata for higher-level stamped data types.\n\
281# This is generally used to communicate timestamped data \n\
282# in a particular coordinate frame.\n\
283# \n\
284# sequence ID: consecutively increasing ID \n\
285uint32 seq\n\
286#Two-integer timestamp that is expressed as:\n\
287# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
288# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
289# time-handling sugar is provided by the client library\n\
290time stamp\n\
291#Frame this data is associated with\n\
292# 0: no frame\n\
293# 1: global frame\n\
294string frame_id\n\
295\n\
296================================================================================\n\
297MSG: sensor_msgs/RegionOfInterest\n\
298# This message is used to specify a region of interest within an image.\n\
299#\n\
300# When used to specify the ROI setting of the camera when the image was\n\
301# taken, the height and width fields should either match the height and\n\
302# width fields for the associated image; or height = width = 0\n\
303# indicates that the full resolution image was captured.\n\
304\n\
305uint32 x_offset # Leftmost pixel of the ROI\n\
306 # (0 if the ROI includes the left edge of the image)\n\
307uint32 y_offset # Topmost pixel of the ROI\n\
308 # (0 if the ROI includes the top edge of the image)\n\
309uint32 height # Height of ROI\n\
310uint32 width # Width of ROI\n\
311\n\
312# True if a distinct rectified ROI should be calculated from the \"raw\"\n\
313# ROI in this message. Typically this should be False if the full image\n\
314# is captured (ROI not used), and True if a subwindow is captured (ROI\n\
315# used).\n\
316bool do_rectify\n\
317";
318
319 yarp::os::Type getType() const override
320 {
321 yarp::os::Type typ = yarp::os::Type::byName(typeName, typeName);
322 typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
323 typ.addProperty("message_definition", yarp::os::Value(typeText));
324 return typ;
325 }
326};
327
328} // namespace sensor_msgs
329} // namespace rosmsg
330} // namespace yarp
331
332#endif // YARP_ROSMSG_sensor_msgs_SetCameraInfo_h
#define BOTTLE_TAG_LIST
Definition: Bottle.h:28
An interface for reading from a network connection.
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isBareMode() const =0
Check if the connection is bare mode.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:171
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:134
A single value (typically within a Bottle).
Definition: Value.h:43
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:21
virtual bool read(yarp::os::idl::WireReader &reader)
virtual bool write(const yarp::os::idl::WireWriter &writer) const
IDL-friendly connection reader.
Definition: WireReader.h:27
yarp::rosmsg::sensor_msgs::SetCameraInfo SetCameraInfo
Definition: SetCameraInfo.h:21
yarp::rosmsg::sensor_msgs::CameraInfo CameraInfo
Definition: CameraInfo.h:21
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:915
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1091
The main, catch-all namespace for YARP.
Definition: dirs.h:16