Question regarding strange outputs from histogram plot
Mostrar comentarios más antiguos
Hi folks,
I have an image which is mostly black, with specks of purple. When I plot the RGB histogram for the image, I get an sharp line in the blue region but zero elsewhere, which I don't think is correct.
Can you please advise me on where I've gone wrong?
Thanks
R3=imhist(img3(:,:,1));
G3=imhist(img3(:,:,2));
B3=imhist(img3(:,:,3));
[pk31, locs31] = max(R3);
[pk32, locs32] = max(G3);
[pk33, locs33] = max(B3);
str31 = strcat('\leftarrow', num2str(locs31));
str32 = strcat('\leftarrow', num2str(locs32));
str33 = strcat('\leftarrow', num2str(locs33));
figure
hold on,
plot(R3,'r'),
text(locs31, pk31, str31),
plot(G3,'g')
text(locs32, pk32, str32),
plot(B3,'b'),
text(locs33, pk33, str33),
legend(' Red channel','Green channel','Blue channel','Location','best');
hold off,title('Mask 2 - RGB Histograms');
xlim([0 20])
ylim([0 5000])


Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Histograms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
