ROS Package for getting RGB-D Images from RGB-D Sensor

I want to create a ROS node that acquires images from RGB-D sensors such as RealSense (planned for improvement)

There are many people doing similar things, but I would like to introduce the ROS package that I made a long time ago. I have posted it on GitHub. https://github.com/moriitkys/color_depth_edit

The selling point of this package is that you can get Depth corresponding to a pixel (x, y) with RGB, and you can visualize and edit Depth image. The selling point of this package is that you can get the Depth corresponding to the pixel (x, y) with RGB, and you can visualize and edit the Depth image.

In the depth_callback function below, depth_img = depth_array * 255/65535 depth_img2 = np.array(depth_img, dtype=np.uint8) depth_color_img = np.stack((depth_img2,)*3, axis=-1) Visualization of Depth and #Extract the center of depth image (20x20 pixels) depth_array2 = depth_array[h/2-10:h/2+10, w/2-10:w/2+10] depth_array3 = depth_array2[depth_array2 > 0] self.m_depth = np.mean(depth_array3) To get the Depth value with.

color_depth_edit.py


def depth_callback(self, data):
        try:
            self._depth_pub.publish(data)
            cv_dimage = self._bridge.imgmsg_to_cv2(data, 'passthrough')
        except CvBridgeError, e:
            print e
        h, w = cv_dimage.shape[:2]
        #you should change under 2 lines if you don't use realsense
        depth_array = np.array(cv_dimage, dtype=np.float32)
        depth_img = depth_array * 255/65535
        depth_img2 = np.array(depth_img, dtype=np.uint8)
        depth_color_img = np.stack((depth_img2,)*3, axis=-1)

        # Extract the center of depth image (20x20 pixels)
        depth_array2 = depth_array[h/2-10:h/2+10, w/2-10:w/2+10]
        depth_array3 = depth_array2[depth_array2 > 0]

        self.m_depth = np.mean(depth_array3)
        print('The mean depth value at the center of image is', self.m_depth)

        depth_out = self.img_edit(depth_color_img)

        try:
            self._depth_pub.publish(self._bridge.cv2_to_imgmsg(depth_out, 'bgr8'))
        except CvBridgeError, e:
            print e

If you open rqt at runtime, it looks like this. color_depth_edit_result.PNG

!! !! !! Updater planned in the future! !! !!

Use syncronization to upgrade to a package that matches the acquisition timing of RGB and Depth.

Recommended Posts

ROS Package for getting RGB-D Images from RGB-D Sensor
Download profile images (icons) for everyone from Slack
From ROS for Windows installation to operation check
Call your own python module from the ROS package