MATLAB Answers

Histogram of color image

83 views (last 30 days)
hudof najeeb
hudof najeeb on 12 Feb 2017
Answered: Image Analyst on 27 May 2020
I hide message inside image using LSB .It is work but I get a different style of output of histogram.how to solve it?
my code is:
subplot(4, 4, 2);
Red = coverimage(:,:,1);
Green = coverimage(:,:,2);
Blue = coverimage(:,:,3);
%Get histValues for each channel
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
%Plot them together in one plot
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title('Histogram of Cover image ', 'FontSize', fontSize);
subplot(4, 4, 4);
Red = stegoimage(:,:,1);
Green = stegoimage(:,:,2);
Blue = stegoimage(:,:,3);
[yRed1, x1] = imhist(Red);
[yGreen1, x1] = imhist(Green);
[yBlue1, x1] = imhist(Blue);
plot(x1, yRed1, 'Red', x1, yGreen1, 'Green', x1, yBlue1, 'Blue');
title('Histogram of Stego image ', 'FontSize', fontSize);

  0 Comments

Sign in to comment.

Answers (3)

muratcan tek
muratcan tek on 27 May 2020
I fixed it
coverimage=imread('image.jpg');
Red = coverimage(:,:,1);
Green = coverimage(:,:,2);
Blue = coverimage(:,:,3);
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
subplot(1, 2, 1);
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title('Histogram of Cover image ', 'FontSize', 1);
subplot(1, 2, 2);
bar(yRed, 'Red') ,hold on , bar(yGreen, 'Green'), hold on ,bar( yBlue, 'Blue');
title('Histogram of Stego image ', 'FontSize', 1);

  0 Comments

Sign in to comment.


muratcan tek
muratcan tek on 27 May 2020
this is better
coverimage=imread('image.jpg');
Red = coverimage(:,:,1);
Green = coverimage(:,:,2);
Blue = coverimage(:,:,3);
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
subplot(1, 2, 1);
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title('Histogram of Cover image ', 'FontSize', 1);
subplot(1, 2, 2);
bar(yRed, 'Red') ,hold on , bar(yGreen, 'Green'), hold on ,bar( yBlue, 'Blue');
title('Histogram of Stego image ', 'FontSize', 1);

  0 Comments

Sign in to comment.


Image Analyst
Image Analyst on 27 May 2020
It's because your cover image has a continuous histogram - counts for every gray level - while your stego image does not. The stego image has no counts for some gray levels. It looks like it contains only even or only odd gray levels, probably as an artifact of your encoding process.

  0 Comments

Sign in to comment.


Translated by