How to plot RGB intensity value from the specific pixel

조회 수: 2 (최근 30일)
joynjo
joynjo 2017년 5월 23일
댓글: joynjo 2017년 5월 23일
How to plot RGB intensity value from the specific pixel?. Let say I have 50 picked pixel coordinate, I would like to plot these values in to RGB graph.

채택된 답변

Walter Roberson
Walter Roberson 2017년 5월 23일
Let R be a vector of the row coordinates of the selected pixels, and C be a vector of the corresponding column coordinates. Let your image be I. Then
reds = I(sub2idx(size(I), R(:), C(:), 1 * ones(length(R),1));
greens = I(sub2idx(size(I), R(:), C(:), 2 * ones(length(R),1));
blues = I(sub2idx(size(I), R(:), C(:), 3 * ones(length(R),1));
Now you could plot in whatever way seems appropriate. For example,
X = 1 : length(reds);
plot(X, reds, 'r', X, greens, 'g', X, blues, 'b');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by