Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Dynamic Thresholding


I have a question about Dynamic Thresholding. I know that Halcon software uses dynamic thresholding for image processing. I was wondering if there's an equivalent for that in OpenCV.

This is what I've found in a Halcon manual:


dyn_threshold(OrigImage, ThresholdImage : RegionDynThresh : Offset, LightDark : )


dyn_threshold selects from the input image those regions in which the pixels fulfill a threshold condition.

Typically, the threshold images are smoothed versions of the original image (e.g., by applying mean_image, binomial_filter, gauss_filter, etc.). Then the effect of dyn_threshold is similar to applying threshold to a highpass-filtered version of the original image (see highpass_image).

With dyn_threshold, contours of an object can be extracted, where the objects' size (diameter) is determined by the mask size of the lowpass filter and the amplitude of the objects' edges:

The larger the mask size is chosen, the larger the found regions become. As a rule of thumb, the mask size should be about twice the diameter of the objects to be extracted. It is important not to set the parameter Offset to zero because in this case too many small regions will be found (noise). Values between 5 and 40 are a useful choice. The larger Offset is chosen, the smaller the extracted regions become.

Or should I manually create a function that does this? (I have no idea how)