Home > detect > imdetect.m

imdetect

PURPOSE ^

detect cell in an image

SYNOPSIS ^

function [region imConf] = imdetect(im,mask,filterSize, kernelSize,radialMeanThreshold)

DESCRIPTION ^

 detect cell in an image 

 USAGE
   im   = imread('someImageYouWantToDetect.ext');
   mask = imread('theBinaryMaskIndicateTheDetectingArea.ext'); 
   positions = imdetect(im, mask, 5, 30, 0.2471);

 INPUT
   im   - the input image
   mask - the binary mask indicate the detecting area. 
        - same size of the image. Leave all white value (== 1) if want to
        detect entire image area.
   filterSize  - filter size for the median filter. Recommended value 5.
   kernelSize  - radial mean kernel size. Recommended value 30.
   radialMeanThreshold   - threshold for detection. 
                           Recommended range 0.2196..0.3059

 OUTPUT
   positions   - positions of cells
   areas       - areas of cells
   imConf      - the image of radial means score

 SEE ALSO radial_mean, medfilt2, bwlabel, regionprops

 Written by Rich Nguyen (rich.uncc@gmail.com)
 Version 1.0, Apr 2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [region imConf] = imdetect(im,mask,filterSize, kernelSize,...
0002     radialMeanThreshold)
0003 % detect cell in an image
0004 %
0005 % USAGE
0006 %   im   = imread('someImageYouWantToDetect.ext');
0007 %   mask = imread('theBinaryMaskIndicateTheDetectingArea.ext');
0008 %   positions = imdetect(im, mask, 5, 30, 0.2471);
0009 %
0010 % INPUT
0011 %   im   - the input image
0012 %   mask - the binary mask indicate the detecting area.
0013 %        - same size of the image. Leave all white value (== 1) if want to
0014 %        detect entire image area.
0015 %   filterSize  - filter size for the median filter. Recommended value 5.
0016 %   kernelSize  - radial mean kernel size. Recommended value 30.
0017 %   radialMeanThreshold   - threshold for detection.
0018 %                           Recommended range 0.2196..0.3059
0019 %
0020 % OUTPUT
0021 %   positions   - positions of cells
0022 %   areas       - areas of cells
0023 %   imConf      - the image of radial means score
0024 %
0025 % SEE ALSO radial_mean, medfilt2, bwlabel, regionprops
0026 %
0027 % Written by Rich Nguyen (rich.uncc@gmail.com)
0028 % Version 1.0, Apr 2010
0029 
0030 
0031 mask = ~logical(mask);
0032 imFilt = medfilt2(im,[filterSize filterSize]);
0033 imConf = radial_mean(imFilt,kernelSize);
0034 imbinary = (imConf > radialMeanThreshold);
0035 
0036 % Make sure the cells only detected in the mask image
0037 imbinary = imbinary & mask;
0038 mask = bwlabel(imbinary,4);
0039 region = regionprops(mask,'Centroid','Area','Orientation','MajorAxisLength','MinorAxisLength');
0040 
0041 
0042 
0043 
0044 
0045 
0046 
0047 
0048 
0049 
0050

Generated on Thu 17-Mar-2011 14:45:51 by m2html © 2005