00001 """autogenerated by genpy from iri_perception_msgs/single_img_detection.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class single_img_detection(genpy.Message):
00009 _md5sum = "391d7f7d52529da7a7a00d7423444dda"
00010 _type = "iri_perception_msgs/single_img_detection"
00011 _has_header = False
00012 _full_text = """# detection identifier
00013 uint32 id
00014
00015 # OpenCV cv::Rect structure
00016 # upper-left corner and width+height from the detection
00017 float32 x
00018 float32 y
00019 float32 width
00020 float32 height
00021
00022 # detection score
00023 float32 score
00024 """
00025 __slots__ = ['id','x','y','width','height','score']
00026 _slot_types = ['uint32','float32','float32','float32','float32','float32']
00027
00028 def __init__(self, *args, **kwds):
00029 """
00030 Constructor. Any message fields that are implicitly/explicitly
00031 set to None will be assigned a default value. The recommend
00032 use is keyword arguments as this is more robust to future message
00033 changes. You cannot mix in-order arguments and keyword arguments.
00034
00035 The available fields are:
00036 id,x,y,width,height,score
00037
00038 :param args: complete set of field values, in .msg order
00039 :param kwds: use keyword arguments corresponding to message field names
00040 to set specific fields.
00041 """
00042 if args or kwds:
00043 super(single_img_detection, self).__init__(*args, **kwds)
00044
00045 if self.id is None:
00046 self.id = 0
00047 if self.x is None:
00048 self.x = 0.
00049 if self.y is None:
00050 self.y = 0.
00051 if self.width is None:
00052 self.width = 0.
00053 if self.height is None:
00054 self.height = 0.
00055 if self.score is None:
00056 self.score = 0.
00057 else:
00058 self.id = 0
00059 self.x = 0.
00060 self.y = 0.
00061 self.width = 0.
00062 self.height = 0.
00063 self.score = 0.
00064
00065 def _get_types(self):
00066 """
00067 internal API method
00068 """
00069 return self._slot_types
00070
00071 def serialize(self, buff):
00072 """
00073 serialize message into buffer
00074 :param buff: buffer, ``StringIO``
00075 """
00076 try:
00077 _x = self
00078 buff.write(_struct_I5f.pack(_x.id, _x.x, _x.y, _x.width, _x.height, _x.score))
00079 except struct.error as se: self._check_types(se)
00080 except TypeError as te: self._check_types(te)
00081
00082 def deserialize(self, str):
00083 """
00084 unpack serialized message in str into this message instance
00085 :param str: byte array of serialized message, ``str``
00086 """
00087 try:
00088 end = 0
00089 _x = self
00090 start = end
00091 end += 24
00092 (_x.id, _x.x, _x.y, _x.width, _x.height, _x.score,) = _struct_I5f.unpack(str[start:end])
00093 return self
00094 except struct.error as e:
00095 raise genpy.DeserializationError(e)
00096
00097
00098 def serialize_numpy(self, buff, numpy):
00099 """
00100 serialize message with numpy array types into buffer
00101 :param buff: buffer, ``StringIO``
00102 :param numpy: numpy python module
00103 """
00104 try:
00105 _x = self
00106 buff.write(_struct_I5f.pack(_x.id, _x.x, _x.y, _x.width, _x.height, _x.score))
00107 except struct.error as se: self._check_types(se)
00108 except TypeError as te: self._check_types(te)
00109
00110 def deserialize_numpy(self, str, numpy):
00111 """
00112 unpack serialized message in str into this message instance using numpy for array types
00113 :param str: byte array of serialized message, ``str``
00114 :param numpy: numpy python module
00115 """
00116 try:
00117 end = 0
00118 _x = self
00119 start = end
00120 end += 24
00121 (_x.id, _x.x, _x.y, _x.width, _x.height, _x.score,) = _struct_I5f.unpack(str[start:end])
00122 return self
00123 except struct.error as e:
00124 raise genpy.DeserializationError(e)
00125
00126 _struct_I = genpy.struct_I
00127 _struct_I5f = struct.Struct("<I5f")