How to get RGB color array from snapshot image?

2 ビュー (過去 30 日間)
Tiago Batanete Marques
Tiago Batanete Marques 2021 年 1 月 25 日
回答済み: Gaurav Garg 2021 年 1 月 28 日
Hi,
I have used the snapshot() function to take a picture with my webcam, and now I want to extract the associated color matrix, in order to do a pointcloud with this color matrix. How can I do it?
The pointcloud function only accepts double or single arrays, and, when I convert the snapshot photo from uint8 to double/single, and then produce the pointcloud, the pointcloud properties show that the color matrix is empty, when it shouldn't be. The problem is, when I try to insert another argument in the pointCloud() function (the color argument), Matlab complains and says that the color array has to be the same size as the image itself (used to produce the pointcloud). How can I tackle this? (I feel like the answer to this question is related to the answer to my first question, but I'm not sure).
Thanks in advance

採用された回答

Gaurav Garg
Gaurav Garg 2021 年 1 月 28 日
Hi Tiago,
You can use getsnapshot() function to get single image frame. You can find the link to doc here.
For an example on how to use this function, you can refer here.

その他の回答 (0 件)

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by