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


cob_object_detection_msgs
Author(s): Florian Weisshardt
autogenerated on Fri Mar 8 2013 15:04:09