Name
dyn_thresholddyn_thresholdDynThresholdDynThreshold — Segment an image using a local threshold.
void DynThreshold(const HObject& OrigImage, const HObject& ThresholdImage, HObject* RegionDynThresh, const HTuple& Offset, const HTuple& LightDark)
HRegion HImage::DynThreshold(const HImage& ThresholdImage, const HTuple& Offset, const HString& LightDark) const
HRegion HImage::DynThreshold(const HImage& ThresholdImage, double Offset, const HString& LightDark) const
HRegion HImage::DynThreshold(const HImage& ThresholdImage, double Offset, const char* LightDark) const
dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThreshold selects from the input image those
regions in which the pixels fulfill a threshold condition. Let
g_{o} = g_{OrigImageOrigImageOrigImageOrigImageorigImage}, and g_{t} =
g_{ThresholdImageThresholdImageThresholdImageThresholdImagethresholdImage}. Then the condition for
LightDarkLightDarkLightDarkLightDarklightDark = 'light' is:
For LightDarkLightDarkLightDarkLightDarklightDark = 'dark' the condition is:
For LightDarkLightDarkLightDarkLightDarklightDark = 'equal' it is:
Finally, for LightDarkLightDarkLightDarkLightDarklightDark = 'not_equal' it is:
Typically, the threshold images are smoothed versions of the
original image (e.g., by applying mean_imagemean_imageMeanImageMeanImageMeanImage,
binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilter, gauss_filtergauss_filterGaussFilterGaussFilterGaussFilter, etc.). Then the
effect of dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThreshold is similar to applying
thresholdthresholdThresholdThresholdThreshold to a highpass-filtered version of the original
image (see highpass_imagehighpass_imageHighpassImageHighpassImageHighpassImage).
With dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThreshold, 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 OffsetOffsetOffsetOffsetoffset 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 OffsetOffsetOffsetOffsetoffset is chosen, the
smaller the extracted regions become.
All points of the input image fulfilling the above condition are
stored jointly in one region. If necessary, the connected
components can be obtained by calling connectionconnectionConnectionConnectionConnection.
If OffsetOffsetOffsetOffsetoffset is chosen from -1 to 1
usually a very noisy region is generated, requiring large storage.
If OffsetOffsetOffsetOffsetoffset is chosen too large (> 60, say) it may happen
that no points fulfill the threshold condition (i.e., an empty
region is returned). If OffsetOffsetOffsetOffsetoffset is chosen too small (<
-60, say) it may happen that all points fulfill the threshold
condition (i.e., a full region is returned).
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
- Automatically parallelized on domain level.
Image containing the local thresholds.
Offset applied to ThresholdImage.
Default value: 5.0
Suggested values: 1.0, 3.0, 5.0, 7.0, 10.0, 20.0, 30.0
Typical range of values: -255.0
≤
Offset
Offset
Offset
Offset
offset
≤
255.0 (lin)
Minimum increment: 0.01
Recommended increment: 5
Restriction: -255 < Offset && Offset < 255
Extract light, dark or similar areas?
Default value:
'light'
"light"
"light"
"light"
"light"
List of values: 'dark'"dark""dark""dark""dark", 'equal'"equal""equal""equal""equal", 'light'"light""light""light""light", 'not_equal'"not_equal""not_equal""not_equal""not_equal"
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
/* Looking for regions with the diameter D */
mean_image(Image,&Mean,D*2+1,D*2+1);
dyn_threshold(Image,Mean,&Seg,5.0,"light");
connection(Seg,&Region);
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
* Looking for regions with the diameter D
mean_image(Image,Mean,D*2+1,D*2+1)
dyn_threshold(Image,Mean,Seg,5,'light')
connection(Seg,Regions)
Let A be the area of the input region. Then the runtime
complexity is O(A).
dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThreshold returns 2 (H_MSG_TRUE) if all parameters are
correct. The behavior with respect to the input images and output
regions can be determined by setting the values of the flags
'no_object_result'"no_object_result""no_object_result""no_object_result""no_object_result", 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result", and
'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region" with set_systemset_systemSetSystemSetSystemSetSystem.
If necessary, an exception is raised.
mean_imagemean_imageMeanImageMeanImageMeanImage,
smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImage,
binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilter,
gauss_filtergauss_filterGaussFilterGaussFilterGaussFilter
connectionconnectionConnectionConnectionConnection,
select_shapeselect_shapeSelectShapeSelectShapeSelectShape,
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomain,
select_grayselect_graySelectGraySelectGraySelectGray,
rank_regionrank_regionRankRegionRankRegionRankRegion,
dilation1dilation1Dilation1Dilation1Dilation1,
openingopeningOpeningOpeningOpening,
erosion1erosion1Erosion1Erosion1Erosion1
check_differencecheck_differenceCheckDifferenceCheckDifferenceCheckDifference,
thresholdthresholdThresholdThresholdThreshold
highpass_imagehighpass_imageHighpassImageHighpassImageHighpassImage,
sub_imagesub_imageSubImageSubImageSubImage
Foundation