如何在 MATLAB 中绘制具有强度信息的 3-D pointCloud 对象? [英] How to plot a 3-D pointCloud object with Intensity information in MATLAB?

查看:123
本文介绍了如何在 MATLAB 中绘制具有强度信息的 3-D pointCloud 对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MATLAB

I am using the MATLAB pointCloud class for working with and displaying 3-D point clouds. I have the coordinates of each point in x-, y-, and z-dimension, as well as a corresponding grayscale intensity value. For example, see the following test data:

x = [0,   1;   0,   1];
y = [0,   0;   1,   1];
z = [0,   0;   0,   0];
c = [0, 1/3; 2/3,   1];

The corresponding pointCloud object is created with

ptCloud = pointCloud(cat(3, x, y, z), 'Intensity', c);

Now I want to plot the point cloud using the pcshow command, i.e.

pcshow(ptCloud, 'MarkerSize', 1000);

Note: the 'MarkerSize' is only for this example, so the four points are clearly visible.

This, however, doesn't take the intensity information into account - as stated in the documentation, this takes the color information of the point cloud object, which doesn't exist in my case. The pointCloud object only allows to save RGB values for each pixel in the color field, i.e. grayscale intensities are not possible.

The pcshow function can also take an xyz array and the corresponding color information as input instead of a pointCloud object. Then, using the grayscale intensity as color information is possible and works as expected:

pcshow(cat(3, x, y, z), c, 'MarkerSize', 1000);

However, I want to keep working with pointCloud objects and not fall back to multiple arrays per frame. How can I use the Intensity information of a pointCloud object in pcshow?

解决方案

The most recent MATLAB versions (at least R2018a) support this behavior out-of-the box. As described in the documentation, for a point cloud object with Location and Intensity information, the intensity value is mapped to a color using the current color map.

So the following code snippet does work as expected in more recent MATLAB versions:

x = [0,   1;   0,   1];
y = [0,   0;   1,   1];
z = [0,   0;   0,   0];
c = [0, 1/3; 2/3,   1];

ptCloud = pointCloud(cat(3, x, y, z), 'Intensity', c);
pcshow(ptCloud, 'MarkerSize', 1000);

这篇关于如何在 MATLAB 中绘制具有强度信息的 3-D pointCloud 对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆