adjimg

PURPOSE ^

ADJIMG adjusts the intensity of the input image.

SYNOPSIS ^

function imgout=adjimg(img,th)

DESCRIPTION ^

 ADJIMG adjusts the intensity of the input image.
 
 ADJIMG adjusts the intensity of the input image based on the mean and the
 standard deviation of the intensitites in the image.
 
 USAGE:
     imgout=adjimg(img); default values are used
 
     imgout=adjimg(img,th); th tunes the adjustment, higher th values
     results in less adjustment
 
 INPUTS:
     img: input grayscale image of double class
 
     th: tuning parameter
 
 OUTPUTS:
     imgout: adjusted image

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function imgout=adjimg(img,th)
0002 % ADJIMG adjusts the intensity of the input image.
0003 %
0004 % ADJIMG adjusts the intensity of the input image based on the mean and the
0005 % standard deviation of the intensitites in the image.
0006 %
0007 % USAGE:
0008 %     imgout=adjimg(img); default values are used
0009 %
0010 %     imgout=adjimg(img,th); th tunes the adjustment, higher th values
0011 %     results in less adjustment
0012 %
0013 % INPUTS:
0014 %     img: input grayscale image of double class
0015 %
0016 %     th: tuning parameter
0017 %
0018 % OUTPUTS:
0019 %     imgout: adjusted image
0020 
0021 
0022 
0023 if nargin<2 || isempty(th)
0024     th=1;
0025 end
0026 mimg=mean2(img);
0027 stdv=std2(img);
0028 
0029 imax=mimg+th*stdv;
0030 imin=mimg-th*stdv;
0031 
0032 if imax>1
0033     imax=1;
0034 end
0035 if imin<0
0036     imin=0;
0037 end
0038 imgout=(img-imin)./(imax-imin);
0039 imgout(imgout>1)=1;
0040 imgout(imgout<0)=0;

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