フィルターのクリア

Promblem video setup as RGB but show in axes but not show in RGB axes show grayscale instead

1 回表示 (過去 30 日間)
I want to show video as RGB but axes show grayscale color instead
RGB2GRAY only accepts a Mx3 matrix for MAP or a MxNx3 input for RGB.

回答 (2 件)

Walter Roberson
Walter Roberson 2017 年 6 月 15 日
Change
data = rgb2gray (getdata(vid,2));
to
temp = getdata(vid,2);
data = cat(3, rgb2gray(temp(:,:,:,1)), rgb2gray(temp(:,:,:,2)));
  4 件のコメント
Walter Roberson
Walter Roberson 2017 年 6 月 15 日
Small correction:
data = cat(4, rgb2gray(temp(:,:,:,1)), rgb2gray(temp(:,:,:,2)));
getdata(vid,2) says to fetch 2 frames. That will give you MxNx3x2 . Assign that to a temporary variable. Now take each MxNx3 slice of it and convert each one through rgb2gray, producing something that is MxNx1 . Now splice them along the 4th dimension to get somehting MxNx1x2
Adisorn Phanukthong
Adisorn Phanukthong 2017 年 6 月 15 日
thank you for good knowledge

サインインしてコメントする。


Image Analyst
Image Analyst 2017 年 6 月 19 日
Make sure the output format of the camera is RGB and not monochrome/grayscale.

Community Treasure Hunt

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

Start Hunting!

Translated by