00001 """autogenerated by genmsg_py from Mask.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import cob_object_detection_msgs.msg
00006 import std_msgs.msg
00007 import sensor_msgs.msg
00008
00009 class Mask(roslib.message.Message):
00010 _md5sum = "e1240778c6320b394ae629a7eb8c26ba"
00011 _type = "cob_object_detection_msgs/Mask"
00012 _has_header = False
00013 _full_text = """# this message is used to mark where an object is present in an image
00014 # this can be done either by a roi region on the image (less precise) or a mask (more precise)
00015
00016 Rect roi
00017
00018 # in the case when mask is used, 'roi' specifies the image region and 'mask'
00019 # (which should be of the same size) a binary mask in that region
00020 sensor_msgs/Image mask
00021
00022 # in the case there is 3D data available, 'indices' are used to index the
00023 # part of the point cloud representing the object
00024 #pcl/PointIndices indices
00025
00026 ================================================================================
00027 MSG: cob_object_detection_msgs/Rect
00028 int32 x
00029 int32 y
00030 int32 width
00031 int32 height
00032
00033 ================================================================================
00034 MSG: sensor_msgs/Image
00035 # This message contains an uncompressed image
00036 # (0, 0) is at top-left corner of image
00037 #
00038
00039 Header header # Header timestamp should be acquisition time of image
00040 # Header frame_id should be optical frame of camera
00041 # origin of frame should be optical center of cameara
00042 # +x should point to the right in the image
00043 # +y should point down in the image
00044 # +z should point into to plane of the image
00045 # If the frame_id here and the frame_id of the CameraInfo
00046 # message associated with the image conflict
00047 # the behavior is undefined
00048
00049 uint32 height # image height, that is, number of rows
00050 uint32 width # image width, that is, number of columns
00051
00052 # The legal values for encoding are in file src/image_encodings.cpp
00053 # If you want to standardize a new string format, join
00054 # ros-users@lists.sourceforge.net and send an email proposing a new encoding.
00055
00056 string encoding # Encoding of pixels -- channel meaning, ordering, size
00057 # taken from the list of strings in src/image_encodings.cpp
00058
00059 uint8 is_bigendian # is this data bigendian?
00060 uint32 step # Full row length in bytes
00061 uint8[] data # actual matrix data, size is (step * rows)
00062
00063 ================================================================================
00064 MSG: std_msgs/Header
00065 # Standard metadata for higher-level stamped data types.
00066 # This is generally used to communicate timestamped data
00067 # in a particular coordinate frame.
00068 #
00069 # sequence ID: consecutively increasing ID
00070 uint32 seq
00071 #Two-integer timestamp that is expressed as:
00072 # * stamp.secs: seconds (stamp_secs) since epoch
00073 # * stamp.nsecs: nanoseconds since stamp_secs
00074 # time-handling sugar is provided by the client library
00075 time stamp
00076 #Frame this data is associated with
00077 # 0: no frame
00078 # 1: global frame
00079 string frame_id
00080
00081 """
00082 __slots__ = ['roi','mask']
00083 _slot_types = ['cob_object_detection_msgs/Rect','sensor_msgs/Image']
00084
00085 def __init__(self, *args, **kwds):
00086 """
00087 Constructor. Any message fields that are implicitly/explicitly
00088 set to None will be assigned a default value. The recommend
00089 use is keyword arguments as this is more robust to future message
00090 changes. You cannot mix in-order arguments and keyword arguments.
00091
00092 The available fields are:
00093 roi,mask
00094
00095 @param args: complete set of field values, in .msg order
00096 @param kwds: use keyword arguments corresponding to message field names
00097 to set specific fields.
00098 """
00099 if args or kwds:
00100 super(Mask, self).__init__(*args, **kwds)
00101
00102 if self.roi is None:
00103 self.roi = cob_object_detection_msgs.msg.Rect()
00104 if self.mask is None:
00105 self.mask = sensor_msgs.msg.Image()
00106 else:
00107 self.roi = cob_object_detection_msgs.msg.Rect()
00108 self.mask = sensor_msgs.msg.Image()
00109
00110 def _get_types(self):
00111 """
00112 internal API method
00113 """
00114 return self._slot_types
00115
00116 def serialize(self, buff):
00117 """
00118 serialize message into buffer
00119 @param buff: buffer
00120 @type buff: StringIO
00121 """
00122 try:
00123 _x = self
00124 buff.write(_struct_4i3I.pack(_x.roi.x, _x.roi.y, _x.roi.width, _x.roi.height, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs))
00125 _x = self.mask.header.frame_id
00126 length = len(_x)
00127 buff.write(struct.pack('<I%ss'%length, length, _x))
00128 _x = self
00129 buff.write(_struct_2I.pack(_x.mask.height, _x.mask.width))
00130 _x = self.mask.encoding
00131 length = len(_x)
00132 buff.write(struct.pack('<I%ss'%length, length, _x))
00133 _x = self
00134 buff.write(_struct_BI.pack(_x.mask.is_bigendian, _x.mask.step))
00135 _x = self.mask.data
00136 length = len(_x)
00137
00138 if type(_x) in [list, tuple]:
00139 buff.write(struct.pack('<I%sB'%length, length, *_x))
00140 else:
00141 buff.write(struct.pack('<I%ss'%length, length, _x))
00142 except struct.error as se: self._check_types(se)
00143 except TypeError as te: self._check_types(te)
00144
00145 def deserialize(self, str):
00146 """
00147 unpack serialized message in str into this message instance
00148 @param str: byte array of serialized message
00149 @type str: str
00150 """
00151 try:
00152 if self.roi is None:
00153 self.roi = cob_object_detection_msgs.msg.Rect()
00154 if self.mask is None:
00155 self.mask = sensor_msgs.msg.Image()
00156 end = 0
00157 _x = self
00158 start = end
00159 end += 28
00160 (_x.roi.x, _x.roi.y, _x.roi.width, _x.roi.height, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs,) = _struct_4i3I.unpack(str[start:end])
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 start = end
00165 end += length
00166 self.mask.header.frame_id = str[start:end]
00167 _x = self
00168 start = end
00169 end += 8
00170 (_x.mask.height, _x.mask.width,) = _struct_2I.unpack(str[start:end])
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 start = end
00175 end += length
00176 self.mask.encoding = str[start:end]
00177 _x = self
00178 start = end
00179 end += 5
00180 (_x.mask.is_bigendian, _x.mask.step,) = _struct_BI.unpack(str[start:end])
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 start = end
00185 end += length
00186 self.mask.data = str[start:end]
00187 return self
00188 except struct.error as e:
00189 raise roslib.message.DeserializationError(e)
00190
00191
00192 def serialize_numpy(self, buff, numpy):
00193 """
00194 serialize message with numpy array types into buffer
00195 @param buff: buffer
00196 @type buff: StringIO
00197 @param numpy: numpy python module
00198 @type numpy module
00199 """
00200 try:
00201 _x = self
00202 buff.write(_struct_4i3I.pack(_x.roi.x, _x.roi.y, _x.roi.width, _x.roi.height, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs))
00203 _x = self.mask.header.frame_id
00204 length = len(_x)
00205 buff.write(struct.pack('<I%ss'%length, length, _x))
00206 _x = self
00207 buff.write(_struct_2I.pack(_x.mask.height, _x.mask.width))
00208 _x = self.mask.encoding
00209 length = len(_x)
00210 buff.write(struct.pack('<I%ss'%length, length, _x))
00211 _x = self
00212 buff.write(_struct_BI.pack(_x.mask.is_bigendian, _x.mask.step))
00213 _x = self.mask.data
00214 length = len(_x)
00215
00216 if type(_x) in [list, tuple]:
00217 buff.write(struct.pack('<I%sB'%length, length, *_x))
00218 else:
00219 buff.write(struct.pack('<I%ss'%length, length, _x))
00220 except struct.error as se: self._check_types(se)
00221 except TypeError as te: self._check_types(te)
00222
00223 def deserialize_numpy(self, str, numpy):
00224 """
00225 unpack serialized message in str into this message instance using numpy for array types
00226 @param str: byte array of serialized message
00227 @type str: str
00228 @param numpy: numpy python module
00229 @type numpy: module
00230 """
00231 try:
00232 if self.roi is None:
00233 self.roi = cob_object_detection_msgs.msg.Rect()
00234 if self.mask is None:
00235 self.mask = sensor_msgs.msg.Image()
00236 end = 0
00237 _x = self
00238 start = end
00239 end += 28
00240 (_x.roi.x, _x.roi.y, _x.roi.width, _x.roi.height, _x.mask.header.seq, _x.mask.header.stamp.secs, _x.mask.header.stamp.nsecs,) = _struct_4i3I.unpack(str[start:end])
00241 start = end
00242 end += 4
00243 (length,) = _struct_I.unpack(str[start:end])
00244 start = end
00245 end += length
00246 self.mask.header.frame_id = str[start:end]
00247 _x = self
00248 start = end
00249 end += 8
00250 (_x.mask.height, _x.mask.width,) = _struct_2I.unpack(str[start:end])
00251 start = end
00252 end += 4
00253 (length,) = _struct_I.unpack(str[start:end])
00254 start = end
00255 end += length
00256 self.mask.encoding = str[start:end]
00257 _x = self
00258 start = end
00259 end += 5
00260 (_x.mask.is_bigendian, _x.mask.step,) = _struct_BI.unpack(str[start:end])
00261 start = end
00262 end += 4
00263 (length,) = _struct_I.unpack(str[start:end])
00264 start = end
00265 end += length
00266 self.mask.data = str[start:end]
00267 return self
00268 except struct.error as e:
00269 raise roslib.message.DeserializationError(e)
00270
00271 _struct_I = roslib.message.struct_I
00272 _struct_4i3I = struct.Struct("<4i3I")
00273 _struct_2I = struct.Struct("<2I")
00274 _struct_BI = struct.Struct("<BI")