yolact_server
Recognize objects from an image using YolactEdge.
- class yolact_server.YolactServer
Bases:
objectYOLACT ROS Action server.
- cv2smi(cv, encode)
Convert from OpenCV image to sensor_msgs/Image.
- Parameters
cv (ndarray) – OpenCV image before conversion.
encode (str) – Conversion encode. mono8: grayscale image. mono16 16-bit grayscale image. bgr8: color image with blue-green-red color order. rgb8: color image with red-green-blue color order. bgra8: BGR color image with an alpha channel. rgba8: RGB color image with an alpha channel.
- Returns
converted Image. If False is returned, the conversion has failed.
- Return type
sensor_msgs/Image
- delete()
- delete_unnecessary_result(cv_rgb, cv_d, classes, scores, boxes, masks)
Delete unnecessary recognition results.
Using max distance (if depth image is available), ignore id, specific id, NMS.
- Parameters
cv_rgb (ndarray) – RGB image.
cv_d (ndarray) – Depth image.
classes (list[str]) – Classes.
scores (list[float]) – Socres.
boxes (list[list[int]]) – Boxes.
masks (list[list[float]]) – Masks.
- Returns
New lists with unnecessary results removed.
- Return type
list[str], list[float], list[list[int]], list[list[float]]
- draw_mask(cv_src, mask, color, alpha=0.5, only_contour=True)
Drawing mask information on the input image.
- Parameters
cv_src (ndarray) – Input image.
mask (_type_) – Mask information.
color (_type_) – Color of mask.
alpha (float, optional) – Transparency of mask. Defaults to 0.5.
only_contour (bool, optional) – Drawing only contours. The mask drawing process is too slow, so True is RECOMMENDED. Defaults to True.
- Returns
Output image after drawing.
- Return type
ndarray
- draw_result(cv_rgb, cv_d, classes, boxes, masks)
“Drawing result on the input image.
- Parameters
cv_src (ndarray) – Input image.
classes (list[str]) – Classes.
boxes (list[list[int]]) – Boxes.
masks (list[list[float]]) – Masks.
- Returns
Output image after drawing.
- Return type
ndarray
- get_new_image(time, is_d)
Get a new images.
- Parameters
time (ROS time) – Get images acquired at a time newer than “time.”
is_d (bool) – Whether or not to get the depth image.
- Returns
RGB and Depth image.
- Return type
sensor_msgs/Image
- main(goal)
Main function.
- Parameters
goal (hma_yolact_action/YolactAction) – Input informations.
- return_failure(message)
Return a failure.
- Parameters
message (str) – Warning messages to be output.
- smi2cv(smi, encode, is_depth=False)
Convert from sensor_msgs/Image to OpenCV image.
- Parameters
smi (sensor_msgs/Image) – Image before conversion.
encode (str) – Conversion encode. mono8: grayscale image. mono16 16-bit grayscale image. bgr8: color image with blue-green-red color order. rgb8: color image with red-green-blue color order. bgra8: BGR color image with an alpha channel. rgba8: RGB color image with an alpha channel.
is_depth (bool, optional) – Whether to convert depth image. Defaults to False.
- Returns
Converted OpenCV image. If False is returned, the conversion has failed.
- Return type
ndarray
- subf_rgb(smi_rgb)
Callback function for RGB image.
- Parameters
smi_rgb (sensor_msg/Image) – RGB image.
- subf_rgbd(smi_rgb, smi_d)
Callback function for RGB and Depth images.
- Parameters
smi_rgb (sensor_msg/Image) – RGB image.
smi_d (sensor_msg/Image) – Depth image.