Wednesday, May 28, 2008

How to do adaptive threshold?

  1. Convolve the image i.e. the mean or median. imageCon=imfilter(imageOri) or medfilter()
  2. Subtract the original from the convolved image. imageDif= imageOri-imageCon;
  3. Threshold the difference image with C(constant). imageThr=imageDif-C;
  4. Invert the thresholded image. imageEnd=imcomplement(imageThr);
See More:"http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm"
Matlab code:"http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8647"

No comments: