필터 지우기
필터 지우기

ROS Point Cloud PreserveStructureOnRead True vs False

조회 수: 1 (최근 30일)
Connor Fuhrman
Connor Fuhrman 2018년 4월 17일
답변: Connor Fuhrman 2018년 4월 17일
I am using the RGB and XYZ data from an ROS PointCloud2 to identify white lines and publish them in a point cloud. I read the RGB and XYZ with the PreserveStructureOnRead as true to get a mxnx3 image. I would like to then convert then to a dx3 matrix so I can publish a point cloud to my ROS environment. What is the mapping to a point in the mxnx3 matrix to the dx3? I notice that d = m*n, but do not know how the two relate to each other. In other words, I would like to convert my image from the PreserveStructureOnRead = true for to the PreserveStructureOnRead = false form.
Thank you!

답변 (1개)

Connor Fuhrman
Connor Fuhrman 2018년 4월 17일

I created this function which I believe solves my own issue!

function dx3 = mxnx3_to_dx3(mxnx3)
[height, width, length] = size(mxnx3);
dx3 = zeros(height*width,3);
for i = 1:length
    for j = 1:height
        for k = 1:width
            l = width*(j-1)+k;
            dx3(l,i) = mxnx3(j,k,i);
        end
    end
end
end

카테고리

Help CenterFile Exchange에서 Specialized Messages에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by