RGB channel extraction problem

1 回表示 (過去 30 日間)
chess
chess 2014 年 8 月 28 日
コメント済み: chess 2014 年 8 月 28 日
I have a question. I have an image that is 1024*1024*3 but when I extract it using :
red=image(1,:,:);
green=image(:,1,:);
blue=image(:,:,1);
then size of red is 1*1024*3, green is 1024*1*3 and blue is 1024*1024. What is wrong with green and red channel why I am not getting a right result and how can I extract their channel?

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 8 月 28 日
編集済み: Geoff Hayes 2014 年 8 月 28 日
chess - to extract the correct channel, you have to remember that it is the third dimension that indicates colour. So if img is your 1024x1024x3 image, then
red = img(:,:,1); % 1 for red
green = img(:,:,2); % 2 for green
blue = img(:,:,3); % 3 for blue
Remember that image is a built-in MATLAB function, and so is not a good name for a local variable.
  1 件のコメント
chess
chess 2014 年 8 月 28 日
Thanks I can't believe what I just asked.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRed についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by