I'd like to plot color image histograms that combine color as RGB
23 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
Adam Danz
2020 年 8 月 5 日
編集済み: Adam Danz
2020 年 8 月 5 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!