対象物のみからRGB値のヒストグラムの作成

以下の画像において、黒い部分の影響を排除し、コインのみからRGB値のヒストグラムを作成したいです。ご教授よろしくお願いいたします。

 채택된 답변

Atsushi Ueno
Atsushi Ueno 2024년 2월 28일

1 개 추천

img = imread("image.jpeg");
ind = all(img,3); % RGB方向にANDをとる(黒は0、黒以外は1)
R = img(:,:,1);
G = img(:,:,2);
B = img(:,:,3);
tiledlayout(3,1)
nexttile
histogram(R(ind))
nexttile
histogram(G(ind))
nexttile
histogram(B(ind))

댓글 수: 1

yoshiki
yoshiki 2024년 2월 29일
ありがとうございました。

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

추가 답변 (0개)

질문:

2024년 2월 28일

댓글:

2024년 2월 29일

Community Treasure Hunt

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

Start Hunting!