Info

この質問は閉じられています。 編集または回答するには再度開いてください。

what's wrong with this code, when i'm trying to read the 3 channels of each frame of the video

3 ビュー (過去 30 日間)
bay rem
bay rem 2016 年 2 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
while i'm reading an RGB video, i wanted to extract for each frame its 3 channels? BUT here results looks weird, any one can Explain to me the reason is? here there is the code i used:
videoReader = vision.VideoFileReader('video3.avi');
J=0;
while ~isDone(videoReader);
J=J+1
frameRGB = step(videoReader);
figure,imshow(frameRGB(:,:,1));
figure,imshow(frameRGB(:,:,2));
figure,imshow(frameRGB(:,:,3));
end
and here there is the three channels extracted:
  1 件のコメント
John BG
John BG 2016 年 2 月 6 日
please hang the original image in this blog .0 imshow shows 1 layer only input as Black&White. You feed RGB layers and you are seeing the grading of each primary colour, but see the grading in grey, not RGB respectively. Or perhaps your input is Black & White and we, the readers, don't know yet.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 2 月 6 日
videoReader = vision.VideoFileReader('video3.avi');
fred = figure();
axred = axes('Parent', fred);
fgreen = figure();
axgreen = axes('Parent', fgreen);
fblue = figure();
axblue = axes('Parent', fblue);
J=0;
while ~isDone(videoReader);
J=J+1
frameRGB = step(videoReader);
imgR = frameRGB;
imgR(:,:,2:3) = 0;
imshow(imgR, 'Parent', axred); title(axred, 'Red pane');
imgG = frameRGB;
imgG(:,:,[1 3]) = 0;
imshow(imgG, 'Parent', axgreen); title(axgreen, 'Green pane');
imgB = frameRGB;
imgB(:,:,1:2) = 0;
imshow(imgB, 'Parent', axblue); title(axblue, 'Blue pane');
drawnow();
end

Community Treasure Hunt

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

Start Hunting!

Translated by