Histogram of color image

69 次查看(过去 30 天)
hudof najeeb
hudof najeeb 2017-2-12
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);

回答(3 个)

muratcan tek
muratcan tek 2020-5-27
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);

muratcan tek
muratcan tek 2020-5-27
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);

Image Analyst
Image Analyst 2020-5-27
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.

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by