Hi dear, Can someone help me telling me what this means?
img = imread('imgs/lego.png');
blue = img(:,:,1);
What return in 'blue'?

 채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 16일

0 개 추천

If imgs/lego.png is an RGB color image, then "blue" will hold the red channel information. If imgs/lego.png is a grayscale image, then "blue" will hold the brightness information. If imgs/lego.png is an indexed (pseudocolor) image, then "blue" will hold the index information but there will be no information available about what color each distinct index is to correspond to.
The first pane, (:,:,1) of an RGB image is the Red information. The second pane, (:,:,2) is the Green information. The third pane, (:,:,3) is the Blue information.

댓글 수: 2

Filipe Ribeiro
Filipe Ribeiro 2016년 3월 16일
Thanks Walter!
Image Analyst
Image Analyst 2016년 3월 16일
Filipe, I'd recommend you use better variable names. "blue" for the red channel is a very deceptive name. Here is the snippet I like to share:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2016년 3월 15일

댓글:

2016년 3월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by