Created
October 18, 2013 17:38
-
-
Save mitjap/7045102 to your computer and use it in GitHub Desktop.
equihist
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
function img_eq = equihist(img) | |
% compute hist with 256 bins | |
h = myhist(img, 256); | |
% cum hist | |
%for i = 2 : size(h(:)) | |
% h(i) = h(i) + h(i-1); | |
%end | |
h = cumsum(h); | |
% normalize hist | |
h *= 256 / max(h); | |
% use hist as a lookup | |
h = uint8(h); | |
img_eq = img; | |
%for row = 1 : size(img, 1) | |
% for col = 1 : size(img, 2) | |
% img_eq(row, col) = h(img(row, col)); | |
% end | |
%end | |
img_eq = h(img); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment