Effacer les filtres
Effacer les filtres

I'd like to plot color image histograms that combine color as RGB

23 vues (au cours des 30 derniers jours)
Jessada Dissopa
Jessada Dissopa le 5 Août 2020
Modifié(e) : Adam Danz le 10 Août 2020
I'd like to plot a histogram of color images that look like this
when each color band overlaps it change colors according to the RGB combination of it. Like Red-Green overlapped area produces Yellow, Green-Blue produces Cyan etc.
Thank you in advance.

Réponses (1)

Adam Danz
Adam Danz le 5 Août 2020
Modifié(e) : Adam Danz le 5 Août 2020
By setting transparency to a value less than 1, overlapping histograms will show the combined colors. However, since the histogram colors are transparent, they aren't truely red, blue, and green and therefore the color combinations won't be truely yellow and cyan.
gaus = @(x,mu,sig,amp,vo)amp*exp(-(((x-mu).^2)/(2*sig.^2)));
x = 1:100;
g1 = gaus(x,10,5,10);
g2 = gaus(x,28,5,12);
g3 = gaus(x,43,11,7);
figure()
hold on
bins = 0:100;
h(1) = histogram('BinEdges',bins,'BinCounts',g1, 'FaceColor', 'b');
h(2) = histogram('BinEdges',bins,'BinCounts',g2, 'FaceColor', 'g');
h(3) = histogram('BinEdges',bins,'BinCounts',g3, 'FaceColor', 'r');
The transparency levels can be changed using
set(h,'FaceAlpha',.4) % 0=completely transparent, 1=opaque
Of course you could compute the individual bar positions (histcounts) and which ones overlap in order to plot the overlapping and non-overlapping regions individually. Then you could set the colors of overlapping and non-overlapping regions independently.
  2 commentaires
Jessada Dissopa
Jessada Dissopa le 6 Août 2020
it's not exactly what i wanted yet. Anyway, thank you.
Adam Danz
Adam Danz le 6 Août 2020
Modifié(e) : Adam Danz le 10 Août 2020
Yes, my first paragraph tells you why it isn't exactly what you wanted.
My last paragraph tells you how to get exactly what you want but it will take some work.
The answer shows the best alternative.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by