Pixel Differnce Histogram Plotting.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How to plot histogram for (PDH) analysis like in the attached image![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1205068/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1205068/image.jpeg)
0 comentarios
Respuestas (1)
Image Analyst
el 24 de Nov. de 2022
2 comentarios
Image Analyst
el 28 de Nov. de 2022
There are examples in the documentation for the functions. You'll see things like this
yourGrayScaleImage = imread('lena_grayscale.jpg');
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(yourGrayScaleImage)
%--------------------------------------------------------------------------------------------------------
% Convert to grayscale if it's not already
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
fprintf('It is not really gray scale like we expected - it is color\n');
% Extract the blue channel.
yourGrayScaleImage = yourGrayScaleImage(:, :, 3);
% Update the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(yourGrayScaleImage)
end
% Display image.
subplot(2, 1, 1);
imshow(yourGrayScaleImage);
title('Cover')
% Take histogram.
[counts, edges] = histcounts(yourGrayScaleImage, 256);
% Plot Histogram
subplot(2, 1, 2);
bar(edges(1:end-1), counts, 1);
grid on;
title('PDH of Cover')
xlabel('Gray Level')
ylabel('Count')
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!