Skip to content

Instantly share code, notes, and snippets.

@ritwikraha
Created January 3, 2020 09:07
Show Gist options
  • Save ritwikraha/c0871fe265e6879ec3e7252e0f783aa4 to your computer and use it in GitHub Desktop.
Save ritwikraha/c0871fe265e6879ec3e7252e0f783aa4 to your computer and use it in GitHub Desktop.
grayImage = imread('cameraman.tif');
subplot(2, 1, 1);
imshow(grayImage);
subplot(2, 1, 2);
histObject = histogram(grayImage, 256, 'Normalization', 'probability')
grid on;
xlabel('Gray Level', 'FontSize', 20);
ylabel('Probability', 'FontSize', 20);
% Extract probabililty of each gray level into a vector "p".
p = histObject.Values;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment