ros-perception / depthimage_to_laserscan

Converts a depth image to a laser scan for use with navigation and localization.
243 stars 163 forks source link

[ERROR] [1548154452.152836138]: Could not convert depth image to laserscan: Depth image has unsupported encoding: rgb8 #36

Open christenbc opened 5 years ago

christenbc commented 5 years ago

The camera is an Intel Sense. Is there any solution to this issue?

BQuin commented 5 years ago

I have a similar issue with an intel sense camera, but with mono16 encoding. Were you able to fix it? Thank you

Ahmedkoptan commented 5 years ago

Same issue here

zouyonghao commented 4 years ago

same here with

Could not convert depth image to laserscan: Depth image has unsupported encoding: mono16
LuigiCerone commented 4 years ago

Any update on this?

clalancette commented 4 years ago

As it stands, depthimage_to_laserscan only supports image encodings of TYPE_16UC1 and TYPE_32FC1 (see https://github.com/ros-perception/depthimage_to_laserscan/blob/547cead75adea252893269044e52c8022877bb6a/src/DepthImageToLaserScan.cpp#L129). All other encodings throw that exception. To fix this issue, you'll have to open a pull request that adds support for converting from another encoding.

Pomu0708 commented 3 years ago

you should convert the type of the image

def callback(self,data):
    try:
        cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8")
    except CvBridgeError as e:
        print(e)

    img = cv2.cvtColor(cv_image,cv2.COLOR_BGR2GRAY)
    img2 = np.array(img, dtype=np.float32) 
    cv2.waitKey(1)

    try:
        self.image_pub.publish(self.bridge.cv2_to_imgmsg(img2, "32FC1"))
    except CvBridgeError as e:
        print(e)
han88 commented 9 months ago

Hi same problem..where do I have to place that code snippet?