Ask Your Question
0

Dynamic Thresholding

asked 2017-12-15 04:32:10 -0500

Andriezel gravatar image

Hi,

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:

Signature

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

Description

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)

Thanks,

Andries

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-12-15 10:24:04 -0500

Tetragramm gravatar image

OpenCV has two different types of dynamic thresholding.

niBlackThreshold and adaptiveThreshold

Be sure to check the documentation at https://docs.opencv.org/3.3.1 to see what's available.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-12-15 04:32:10 -0500

Seen: 76 times

Last updated: Dec 15 '17