MATLAB: How to overlap two histograms , one generated from reference image other for noisy image

i want to plot histograms of images in different colors and then overlap.Image Processing Toolbox

Actual Program which I tried is,
Prog 1: A = imread('frame2.bmp'); I = rgb2gray(A); J = imnoise(I,'salt & pepper',0.2); figure; imshow(I);title('original image'); figure; imshow(J);title('image with salt&pepper noise=0.2'); figure; imhist(I);title('histogram of refrece image'); figure; imhist(J);title('histogram of salt&pepper noisy image'); figure; K=imhist(I)+imhist(J); hist(K); But didn't get desired output.

Best Answer

Do you have R2015b? You can overlap histograms with histogram() - just look at the example in the help:
x = randn(2000,1);
y = 1 + randn(5000,1);
h1 = histogram(x);
hold on
h2 = histogram(y);
Related Question