Note: also posted on answers.ros.org at https://answers.ros.org/question/292031/matlab-16uc1-or-32fc1-conversion/
ROS Image Encoding 16UC1 and 32FC1
조회 수: 6 (최근 30일)
이전 댓글 표시
I have some image processing code in MATLAB and am attempting to use it with ROS. I read in a PointCloud2 object and execute readRGB(ptcloud) and readXYZ(ptcloud)where I get two MATLAB images each of size 480x640x3.
Q1: I assume that a depth image of size NxMx3 gives X, Y, and Z distances as the three channels. Is this correct??
I then execute my processing and need to send a depth image back encoded in either 16uc1 or 32fc1. I have not found a built-in MATLAB function for this. I can write a conversion script myself but I am unfamiliar with these formats.
Q2: What is the general algorithm to convert my NxMx3 matrix into either format?
My depth camera node publishes a depth image in the 16uc1 format. When I subscribe to that in MATLAB and execute readImage(ros_image) I get an image of size 480x640x1 in MATLAB but when I execute rostopic echo /ros_depth_image_topic I see the data is given as "data: array: type uint8, length: 614400".
Q3: I notice this is 480*640*2 so why does MATLAB only read in a 480x640x1 image? How do the 614400 data points translate to only 307200 data points in MATLAB?
Thank you for any assistance offered!
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Network Connection and Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!