How to remove points of a specific color from a point cloud? (Comp Vis Toolbox)

5 ビュー (過去 30 日間)
TH
TH 2018 年 5 月 30 日
回答済み: Prateek Rai 2020 年 6 月 19 日
I'm using the Computer Vision toolbox to track several objects for which I have point cloud data of their shapes.
In segmenting each object out of their frame, I set all other color to NaN as rectifyStereoImages requires the two images to be of equal size. When reconstructing scene however, the NaN point are also rectified and reconstructed into the point cloud.
Is there a simple way, once I have the point cloud, to identify points with NaN color and remove them from the cloud?
My first solution was to use isnan for the pointCloud.Color array but that only sets color to zero rather than removes the point.

回答 (1 件)

Prateek Rai
Prateek Rai 2020 年 6 月 19 日
As per my understanding, you are having a point cloud and you want to identify points with point.Color as NaNs and remove them from the point cloud.
To solve this problem efficiently you can use “find” along with “isnan”.
Here is a sample code which performs similar task :
A=[1 1 1;2 2 3;3 3 3;NaN NaN NaN;4 4 4;5 5 5;NaN NaN NaN;NaN NaN NaN]
B=isnan(A(:,1))
idx=find(B)
A(idx,:)=[]
You can refer the following MATLAB documentation links on “isnan” and “find” respectively for more details.

カテゴリ

Help Center および File ExchangePoint Cloud Processing についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by