adaptimadj

PURPOSE ^

ADAPTIMADJ adaptively adjusts the intensity of an image

SYNOPSIS ^

function imgout=adaptimadj(img,win,th)

DESCRIPTION ^

 ADAPTIMADJ adaptively adjusts the intensity of an image

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function imgout=adaptimadj(img,win,th)
0002 % ADAPTIMADJ adaptively adjusts the intensity of an image
0003 
0004 % ADAPTIMADJ adaptively adjusts the intensity of the input image. The
0005 % adjustment is performed according to the mean and standard deviation of
0006 % the region around each pixel.
0007 %
0008 % USAGE:
0009 %     imgout=adaptimadj(img); default window size is min(size(img))/5,
0010 %     default th is 1.
0011 %
0012 % INPUTS:
0013 %     img: grayscale double image
0014 %
0015 %     win: size of the rectangular region to inspect at each pixel
0016 %
0017 %     th: parameters that tunes the degree of adjustment
0018 %
0019 % OUTPUTS:
0020 %     imgout: adjusted image
0021 
0022 % check input
0023 if nargin<2 || isempty(win);
0024     win=round(min(size(img))/5);
0025 end
0026 if nargin<3 || isempty(th)
0027     th=1;
0028 end
0029 
0030 
0031 [mimg,stdv]=adaptstats(img,win);
0032 
0033 imax=mimg+th*stdv;
0034 imin=mimg-th*stdv;
0035 
0036 % clip
0037 imax(imax>1)=1;
0038 imin(imin<0)=0;
0039 
0040 imgout=(img-imin)./(imax-imin);
0041 
0042 % adjust for clipping and saturation
0043 imgout(imgout>1)=1;
0044 imgout(imgout<0)=0;

Generated on Sun 04-Apr-2010 17:13:59 by m2html © 2005