Weird Calculation difference using uint16 and double for an image
Show older comments
Hello, I have a function that calculates the "contrast" of a greyscale image
function FM=CalculateBrenner(Image)
[M N] = size(Image);
DH = Image;
DV = Image;
DH(1:M-2,:) = diff(Image,2,1);
DV(:,1:N-2) = diff(Image,2,2); % second order difference between
% columns, i.e., along x-direction.
FM = max(DH, DV);
FM = FM.^2;
FM = mean2(FM);
end
when my image is a uint16, I get
FM= 100.39
max=438
min=22
But when my image is cast as a double
I get:
FM = 204.14
max=438.00
min= 22.00
So why is the calculation FM different for both cases, yet the values its using are the same (indicated by the max & min)
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!