00001 """autogenerated by genpy from cob_object_detection_msgs/MaskArray.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import cob_object_detection_msgs.msg
00008 import sensor_msgs.msg
00009 import std_msgs.msg
00010
00011 class MaskArray(genpy.Message):
00012 _md5sum = "1d4620a4218f096b919a95d7fb64146f"
00013 _type = "cob_object_detection_msgs/MaskArray"
00014 _has_header = True
00015 _full_text = """Header header
00016 Mask[] masks
00017
00018 ================================================================================
00019 MSG: std_msgs/Header
00020 # Standard metadata for higher-level stamped data types.
00021 # This is generally used to communicate timestamped data
00022 # in a particular coordinate frame.
00023 #
00024 # sequence ID: consecutively increasing ID
00025 uint32 seq
00026 #Two-integer timestamp that is expressed as:
00027 # * stamp.secs: seconds (stamp_secs) since epoch
00028 # * stamp.nsecs: nanoseconds since stamp_secs
00029 # time-handling sugar is provided by the client library
00030 time stamp
00031 #Frame this data is associated with
00032 # 0: no frame
00033 # 1: global frame
00034 string frame_id
00035
00036 ================================================================================
00037 MSG: cob_object_detection_msgs/Mask
00038 # this message is used to mark where an object is present in an image
00039 # this can be done either by a roi region on the image (less precise) or a mask (more precise)
00040
00041 Rect roi
00042
00043 # in the case when mask is used, 'roi' specifies the image region and 'mask'
00044 # (which should be of the same size) a binary mask in that region
00045 sensor_msgs/Image mask
00046
00047 # in the case there is 3D data available, 'indices' are used to index the
00048 # part of the point cloud representing the object
00049 #pcl/PointIndices indices
00050
00051 ================================================================================
00052 MSG: cob_object_detection_msgs/Rect
00053 int32 x
00054 int32 y
00055 int32 width
00056 int32 height
00057
00058 ================================================================================
00059 MSG: sensor_msgs/Image
00060 # This message contains an uncompressed image
00061 # (0, 0) is at top-left corner of image
00062 #
00063
00064 Header header # Header timestamp should be acquisition time of image
00065 # Header frame_id should be optical frame of camera
00066 # origin of frame should be optical center of cameara
00067 # +x should point to the right in the image
00068 # +y should point down in the image
00069 # +z should point into to plane of the image
00070 # If the frame_id here and the frame_id of the CameraInfo
00071 # message associated with the image conflict
00072 # the behavior is undefined
00073
00074 uint32 height # image height, that is, number of rows
00075 uint32 width # image width, that is, number of columns
00076
00077 # The legal values for encoding are in file src/image_encodings.cpp
00078 # If you want to standardize a new string format, join
00079 # ros-users@lists.sourceforge.net and send an email proposing a new encoding.
00080
00081 string encoding # Encoding of pixels -- channel meaning, ordering, size
00082 # taken from the list of strings in src/image_encodings.cpp
00083
00084 uint8 is_bigendian # is this data bigendian?
00085 uint32 step # Full row length in bytes
00086 uint8[] data # actual matrix data, size is (step * rows)
00087
00088 """
00089 __slots__ = ['header','masks']
00090 _slot_types = ['std_msgs/Header','cob_object_detection_msgs/Mask[]']
00091
00092 def __init__(self, *args, **kwds):
00093 """
00094 Constructor. Any message fields that are implicitly/explicitly
00095 set to None will be assigned a default value. The recommend
00096 use is keyword arguments as this is more robust to future message
00097 changes. You cannot mix in-order arguments and keyword arguments.
00098
00099 The available fields are:
00100 header,masks
00101
00102 :param args: complete set of field values, in .msg order
00103 :param kwds: use keyword arguments corresponding to message field names
00104 to set specific fields.
00105 """
00106 if args or kwds:
00107 super(MaskArray, self).__init__(*args, **kwds)
00108
00109 if self.header is None:
00110 self.header = std_msgs.msg.Header()
00111 if self.masks is None:
00112 self.masks = []
00113 else:
00114 self.header = std_msgs.msg.Header()
00115 self.masks = []
00116
00117 def _get_types(self):
00118 """
00119 internal API method
00120 """
00121 return self._slot_types
00122
00123 def serialize(self, buff):
00124 """
00125 serialize message into buffer
00126 :param buff: buffer, ``StringIO``
00127 """
00128 try:
00129 _x = self
00130 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00131 _x = self.header.frame_id
00132 length = len(_x)
00133 if python3 or type(_x) == unicode:
00134 _x = _x.encode('utf-8')
00135 length = len(_x)
00136 buff.write(struct.pack('<I%ss'%length, length, _x))
00137 length = len(self.masks)
00138 buff.write(_struct_I.pack(length))
00139 for val1 in self.masks:
00140 _v1 = val1.roi
00141 _x = _v1
00142 buff.write(_struct_4i.pack(_x.x, _x.y, _x.width, _x.height))
00143 _v2 = val1.mask
00144 _v3 = _v2.header
00145 buff.write(_struct_I.pack(_v3.seq))
00146 _v4 = _v3.stamp
00147 _x = _v4
00148 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00149 _x = _v3.frame_id
00150 length = len(_x)
00151 if python3 or type(_x) == unicode:
00152 _x = _x.encode('utf-8')
00153 length = len(_x)
00154 buff.write(struct.pack('<I%ss'%length, length, _x))
00155 _x = _v2
00156 buff.write(_struct_2I.pack(_x.height, _x.width))
00157 _x = _v2.encoding
00158 length = len(_x)
00159 if python3 or type(_x) == unicode:
00160 _x = _x.encode('utf-8')
00161 length = len(_x)
00162 buff.write(struct.pack('<I%ss'%length, length, _x))
00163 _x = _v2
00164 buff.write(_struct_BI.pack(_x.is_bigendian, _x.step))
00165 _x = _v2.data
00166 length = len(_x)
00167
00168 if type(_x) in [list, tuple]:
00169 buff.write(struct.pack('<I%sB'%length, length, *_x))
00170 else:
00171 buff.write(struct.pack('<I%ss'%length, length, _x))
00172 except struct.error as se: self._check_types(se)
00173 except TypeError as te: self._check_types(te)
00174
00175 def deserialize(self, str):
00176 """
00177 unpack serialized message in str into this message instance
00178 :param str: byte array of serialized message, ``str``
00179 """
00180 try:
00181 if self.header is None:
00182 self.header = std_msgs.msg.Header()
00183 if self.masks is None:
00184 self.masks = None
00185 end = 0
00186 _x = self
00187 start = end
00188 end += 12
00189 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00190 start = end
00191 end += 4
00192 (length,) = _struct_I.unpack(str[start:end])
00193 start = end
00194 end += length
00195 if python3:
00196 self.header.frame_id = str[start:end].decode('utf-8')
00197 else:
00198 self.header.frame_id = str[start:end]
00199 start = end
00200 end += 4
00201 (length,) = _struct_I.unpack(str[start:end])
00202 self.masks = []
00203 for i in range(0, length):
00204 val1 = cob_object_detection_msgs.msg.Mask()
00205 _v5 = val1.roi
00206 _x = _v5
00207 start = end
00208 end += 16
00209 (_x.x, _x.y, _x.width, _x.height,) = _struct_4i.unpack(str[start:end])
00210 _v6 = val1.mask
00211 _v7 = _v6.header
00212 start = end
00213 end += 4
00214 (_v7.seq,) = _struct_I.unpack(str[start:end])
00215 _v8 = _v7.stamp
00216 _x = _v8
00217 start = end
00218 end += 8
00219 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 start = end
00224 end += length
00225 if python3:
00226 _v7.frame_id = str[start:end].decode('utf-8')
00227 else:
00228 _v7.frame_id = str[start:end]
00229 _x = _v6
00230 start = end
00231 end += 8
00232 (_x.height, _x.width,) = _struct_2I.unpack(str[start:end])
00233 start = end
00234 end += 4
00235 (length,) = _struct_I.unpack(str[start:end])
00236 start = end
00237 end += length
00238 if python3:
00239 _v6.encoding = str[start:end].decode('utf-8')
00240 else:
00241 _v6.encoding = str[start:end]
00242 _x = _v6
00243 start = end
00244 end += 5
00245 (_x.is_bigendian, _x.step,) = _struct_BI.unpack(str[start:end])
00246 start = end
00247 end += 4
00248 (length,) = _struct_I.unpack(str[start:end])
00249 start = end
00250 end += length
00251 if python3:
00252 _v6.data = str[start:end].decode('utf-8')
00253 else:
00254 _v6.data = str[start:end]
00255 self.masks.append(val1)
00256 return self
00257 except struct.error as e:
00258 raise genpy.DeserializationError(e)
00259
00260
00261 def serialize_numpy(self, buff, numpy):
00262 """
00263 serialize message with numpy array types into buffer
00264 :param buff: buffer, ``StringIO``
00265 :param numpy: numpy python module
00266 """
00267 try:
00268 _x = self
00269 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00270 _x = self.header.frame_id
00271 length = len(_x)
00272 if python3 or type(_x) == unicode:
00273 _x = _x.encode('utf-8')
00274 length = len(_x)
00275 buff.write(struct.pack('<I%ss'%length, length, _x))
00276 length = len(self.masks)
00277 buff.write(_struct_I.pack(length))
00278 for val1 in self.masks:
00279 _v9 = val1.roi
00280 _x = _v9
00281 buff.write(_struct_4i.pack(_x.x, _x.y, _x.width, _x.height))
00282 _v10 = val1.mask
00283 _v11 = _v10.header
00284 buff.write(_struct_I.pack(_v11.seq))
00285 _v12 = _v11.stamp
00286 _x = _v12
00287 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00288 _x = _v11.frame_id
00289 length = len(_x)
00290 if python3 or type(_x) == unicode:
00291 _x = _x.encode('utf-8')
00292 length = len(_x)
00293 buff.write(struct.pack('<I%ss'%length, length, _x))
00294 _x = _v10
00295 buff.write(_struct_2I.pack(_x.height, _x.width))
00296 _x = _v10.encoding
00297 length = len(_x)
00298 if python3 or type(_x) == unicode:
00299 _x = _x.encode('utf-8')
00300 length = len(_x)
00301 buff.write(struct.pack('<I%ss'%length, length, _x))
00302 _x = _v10
00303 buff.write(_struct_BI.pack(_x.is_bigendian, _x.step))
00304 _x = _v10.data
00305 length = len(_x)
00306
00307 if type(_x) in [list, tuple]:
00308 buff.write(struct.pack('<I%sB'%length, length, *_x))
00309 else:
00310 buff.write(struct.pack('<I%ss'%length, length, _x))
00311 except struct.error as se: self._check_types(se)
00312 except TypeError as te: self._check_types(te)
00313
00314 def deserialize_numpy(self, str, numpy):
00315 """
00316 unpack serialized message in str into this message instance using numpy for array types
00317 :param str: byte array of serialized message, ``str``
00318 :param numpy: numpy python module
00319 """
00320 try:
00321 if self.header is None:
00322 self.header = std_msgs.msg.Header()
00323 if self.masks is None:
00324 self.masks = None
00325 end = 0
00326 _x = self
00327 start = end
00328 end += 12
00329 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00330 start = end
00331 end += 4
00332 (length,) = _struct_I.unpack(str[start:end])
00333 start = end
00334 end += length
00335 if python3:
00336 self.header.frame_id = str[start:end].decode('utf-8')
00337 else:
00338 self.header.frame_id = str[start:end]
00339 start = end
00340 end += 4
00341 (length,) = _struct_I.unpack(str[start:end])
00342 self.masks = []
00343 for i in range(0, length):
00344 val1 = cob_object_detection_msgs.msg.Mask()
00345 _v13 = val1.roi
00346 _x = _v13
00347 start = end
00348 end += 16
00349 (_x.x, _x.y, _x.width, _x.height,) = _struct_4i.unpack(str[start:end])
00350 _v14 = val1.mask
00351 _v15 = _v14.header
00352 start = end
00353 end += 4
00354 (_v15.seq,) = _struct_I.unpack(str[start:end])
00355 _v16 = _v15.stamp
00356 _x = _v16
00357 start = end
00358 end += 8
00359 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00360 start = end
00361 end += 4
00362 (length,) = _struct_I.unpack(str[start:end])
00363 start = end
00364 end += length
00365 if python3:
00366 _v15.frame_id = str[start:end].decode('utf-8')
00367 else:
00368 _v15.frame_id = str[start:end]
00369 _x = _v14
00370 start = end
00371 end += 8
00372 (_x.height, _x.width,) = _struct_2I.unpack(str[start:end])
00373 start = end
00374 end += 4
00375 (length,) = _struct_I.unpack(str[start:end])
00376 start = end
00377 end += length
00378 if python3:
00379 _v14.encoding = str[start:end].decode('utf-8')
00380 else:
00381 _v14.encoding = str[start:end]
00382 _x = _v14
00383 start = end
00384 end += 5
00385 (_x.is_bigendian, _x.step,) = _struct_BI.unpack(str[start:end])
00386 start = end
00387 end += 4
00388 (length,) = _struct_I.unpack(str[start:end])
00389 start = end
00390 end += length
00391 if python3:
00392 _v14.data = str[start:end].decode('utf-8')
00393 else:
00394 _v14.data = str[start:end]
00395 self.masks.append(val1)
00396 return self
00397 except struct.error as e:
00398 raise genpy.DeserializationError(e)
00399
00400 _struct_I = genpy.struct_I
00401 _struct_3I = struct.Struct("<3I")
00402 _struct_BI = struct.Struct("<BI")
00403 _struct_2I = struct.Struct("<2I")
00404 _struct_4i = struct.Struct("<4i")