Mar 20, 2013

Contrast Stretching


In contrast strertching we expand the range of intesity levels so that it spans the full intensity range by applying the following.
function [B] = ContrastStretching(A,min,max)
%input is converted to double
A = double(A);
%Initialize the row & columns
[row,cols] = size (A);
for k = 1 : row
    for l = 1 : cols
      %Do the following according to comparission
      %Apply the equations
      if A(k,l) <= min
      B(k,l) = 0;
        else if  A(k,l) > min && A(k,l) < max
        B(k,l) = (A(k,l)-min) / (max -min);
          else if A(k,l) >= max
          B(k,l) =1;
          end
        end
      end            
    end
end
end
Washed out pollen image
Corrected pollen image

No comments:

Post a Comment