Exemplo n.º 1
0
    def _draw_tips(self, image, tips):
        """Take an Image message and a Tips message, draw a boc around the
        tips in the image and publish the result.

        Record *image*'s sequence number in _last_published_seq.
        """

        # Convert image into RGB image
        rgb_im = image_to_array(image)

        # Use OpenCV to draw boxes in image
        for tip in tips.tips:
            roi = tip.roi

            # NB: cv2.circle will modify the image it works on.
	    if (roi.x, roi.y)!=(0,0):
        	cv2.circle(rgb_im,
                    (roi.x, roi.y),
                    5,
                    (0, 255, 0), # green
                    2 # thickness
                )

        # Publish image
        self._image_pub.publish(array_to_image(rgb_im))
        self._last_published_seq = image.header.seq
    def _draw_tips(self, image, tips):
        """Take an Image message and a Tips message, draw a boc around the
        tips in the image and publish the result.

        Record *image*'s sequence number in _last_published_seq.
        """

        # Convert image into RGB image
        rgb_im = image_to_array(image)

        # Use OpenCV to draw boxes in image
        for tip in tips.tips:
            roi = tip.roi

            # NB: cv2.circle will modify the image it works on.
            if (roi.x, roi.y) != (0, 0):
                cv2.circle(
                    rgb_im,
                    (roi.x, roi.y),
                    5,
                    (0, 255, 0),  # green
                    2  # thickness
                )

        # Publish image
        self._image_pub.publish(array_to_image(rgb_im))
        self._last_published_seq = image.header.seq
Exemplo n.º 3
0
def got_image(image_message):
    STATE["last_image_header"]=image_message.header
    STATE["image"]=image_to_array(image_message)
    if STATE["image"] is not None:
        handle_images()