image processing - How to concatenate 3 histograms on the same graph in Matlab -


i have calculated 3 histograms rgb image using imhist function in matlab, 1 each channel. want plot these histograms on same graph, instance, histogram first (red) channel stretches on x axis 0 255, histogram second channel stretches 256 511, , histogram third channel stretches 512 767. how can this?

assuming uint8 precision, each call imhist give 256 x 1 vector, , can concatenate these single 768 x 1 vector. after, call bar histc flag. assuming have image stored in im, this:

red = imhist(im(:,:,1)); green = imhist(im(:,:,2)); blue = imhist(im(:,:,3)); h = [red; green; blue]; bar(h, 'histc'); 

as example, using onion.png image that's part of image processing toolbox:

im = imread('onion.png'); 

this image looks like:

using above code plot concatenated histogram produces graph:

enter image description here


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -