Last active
February 6, 2022 22:38
-
-
Save MichaelTr7/7d3d6cbe99493dbd24db1190ce3db262 to your computer and use it in GitHub Desktop.
Retrieving histogram of greyscale image in MATLAB (without imhist() and histogram() functions).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc; | |
clear; | |
clf; | |
Image = rgb2gray(imread("peppers.png")); | |
Bins = zeros(256,1); | |
for Intensity = 0: 255 | |
Bins(Intensity+1) = nnz(Image == Intensity); | |
end | |
plot((0:255),Bins); | |
xlabel("Pixel Intensity"); ylabel("Number of Occurences"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment