image = | adaptiveThreshold3dImg (inImg3d,inKnlXYZ) |
image = | adaptiveThresholdGaussian3dImg (inImg3d,halfKnlSize) |
Binarize a 3d input image according an adaptive threshold based on the voxel's neighbourhood.
For each voxel, the algorithm computes a threshold according to a neighbourhood described by the input kernel size as follows :
Where is the voxel's neighbourhood.
For example, the threshold can be the mean intensity in the neighbourhood with each kernel coefficients set to , with
being the number of voxels in the neighbourhood.
It is also possible to call the adaptiveThresholdGaussian3dImg wrapper, which needs the half kernel size instead of the kernel as input data. In this case, a predifined Gaussian kernel is used, whose coefficients are computed with the folowing standard deviation (see http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html#Mat%20getGaussianKernel%28int%20ksize,%20double%20sigma,%20int%20ktype%29) :
Where is the kernel size :
.
See Adaptive Threshold 2d binarization for a 2d example of the adaptative threshold result.