HALCON Reference Manual 10.0.2
Name
dual_thresholddual_thresholddual_thresholdDualThresholdDualThreshold — Threshold operator for signed images.
dual_thresholddual_thresholddual_thresholdDualThresholdDualThreshold segments the input image into a region with
gray values >= Threshold (“positive”
regions) and a region with gray values <= -Threshold (“negative” regions). “Positive” or
“negative” regions having a size of less than MinSizeMinSizeMinSizeMinSizeminSize are
suppressed, as well as regions whose maximum gray value is less than
MinGrayMinGrayMinGrayMinGrayminGray in absolute value.
The segmentation performed is not complete, i.e., the “positive”
and “negative” regions together do not necessarily cover the
entire image: Areas with a gray value between
-ThresholdThresholdThresholdThresholdthreshold and
ThresholdThresholdThresholdThresholdthreshold, -MinGrayMinGrayMinGrayMinGrayminGray and
MinGrayMinGrayMinGrayMinGrayminGray, respectively, are not taken into account.
dual_thresholddual_thresholddual_thresholdDualThresholdDualThreshold is usually called after applying a Laplace
operator (laplacelaplacelaplaceLaplaceLaplace, laplace_of_gausslaplace_of_gausslaplace_of_gaussLaplaceOfGaussLaplaceOfGauss,
derivate_gaussderivate_gaussderivate_gaussDerivateGaussDerivateGauss or diff_of_gaussdiff_of_gaussdiff_of_gaussDiffOfGaussDiffOfGauss) to an image or with
the difference of two images (sub_imagesub_imagesub_imageSubImageSubImage).
The zero crossings of a Laplace image correspond to edges in an
image, and are the separating regions of the “positive” and
“negative” regions in the Laplace image. They can be determined
by calling dual_thresholddual_thresholddual_thresholdDualThresholdDualThreshold with ThresholdThresholdThresholdThresholdthreshold = 1 and
then creating the complement regions with complementcomplementcomplementComplementComplement. The
parameter MinGrayMinGrayMinGrayMinGrayminGray determines the noise invariance, while
MinSizeMinSizeMinSizeMinSizeminSize determines the resolution of the edge detection.
Using byte images, only the positive part of the operator is
applied. Therefore dual_thresholddual_thresholddual_thresholdDualThresholdDualThreshold behaves like a standard
threshold operator (thresholdthresholdthresholdThresholdThreshold) with successive
connectionconnectionconnectionConnectionConnection and select_grayselect_grayselect_graySelectGraySelectGray.
- 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 internal data level.
Positive and negative regions.
Regions smaller than MinSize are suppressed.
Default value: 20
Suggested values: 0, 10, 20, 50, 100, 200, 500, 1000
Typical range of values: 0
≤
MinSize
MinSize
MinSize
MinSize
minSize
≤
10000 (lin)
Minimum increment: 1
Recommended increment: 10
Regions whose maximum absolute gray value is smaller
than MinGray are suppressed.
Default value: 5.0
Suggested values: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 11.0, 15.0, 20.0
Typical range of values: 0.001
≤
MinGray
MinGray
MinGray
MinGray
minGray
≤
10000.0 (lin)
Minimum increment: 1.0
Recommended increment: 10.0
Restriction: MinGray > 0
Regions that have a gray value smaller than Threshold
(or larger than -Threshold) are suppressed.
Default value: 2.0
Suggested values: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 11.0, 15.0, 20.0
Typical range of values: 0.001
≤
Threshold
Threshold
Threshold
Threshold
threshold
≤
10000.0 (lin)
Minimum increment: 1.0
Recommended increment: 10.0
Restriction: (Threshold >= 1) && (Threshold <= MinGray)
* Edge detection with the Laplace operator (and edge thinning)
diff_of_gauss(Image,Laplace,2.0,1.6)
* find "`positive"' and "`negative"' regions:
dual_threshold(Laplace,Region,20,2,1)
* The zero runnings are the complement to these image section:
complement(Region,ZeroCrossings)
* Simulation of dual_threshold
dual_threshold(Laplace,Result,MinS,MinG,Threshold)
threshold(Laplace,Tmp1,Threshold,999999)
connection(Tmp1,Tmp2)
select_shape(Tmp2,Tmp3,'area','and',MinS,999999)
select_gray(Laplace,Tmp3,Tmp4,'max','and',MinG,999999)
threshold(Laplace,Tmp5,-999999,-Threshold)
connection(Tmp5,Tmp6)
select_shape(Tmp6,Tmp7,'area','and',MinS,999999)
select_gray(Laplace,Tmp7,Tmp8,'min','and',-999999,-MinG)
concat_obj(Tmp4,Tmp8,Result)
/* Edge detection with the Laplace operator (and edge thinning) */
diff_of_gauss(Image,&Laplace,2.0,1.6) ;
/* find "`positive"' and "`negative"' regions: */
dual_threshold(Laplace,&Region,20,2,1) ;
/*The zero runnings are the complement to these image section: */
complement(Region,ZeroCrossings) ;
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
if (argc != 2)
{
cout << "Usage : " << argv[0] << " 'image' " << endl;
return (-1);
}
HImage image (argv[1]),
laplace;
HWindow win;
HRegionArray region,
nulldg;
image.Display (win);
laplace = image.DiffOfGauss (2.0, 1.6);
region = laplace.DualThreshold (20, 2, 1);
nulldg = region.Complement ();
laplace.Display (win); win.Click ();
region.Display (win); win.Click ();
nulldg.Display (win); win.Click ();
return (0);
}
* Edge detection with the Laplace operator (and edge thinning)
diff_of_gauss(Image,Laplace,2.0,1.6)
* find "`positive"' and "`negative"' regions:
dual_threshold(Laplace,Region,20,2,1)
* The zero runnings are the complement to these image section:
complement(Region,ZeroCrossings)
* Simulation of dual_threshold
dual_threshold(Laplace,Result,MinS,MinG,Threshold)
threshold(Laplace,Tmp1,Threshold,999999)
connection(Tmp1,Tmp2)
select_shape(Tmp2,Tmp3,'area','and',MinS,999999)
select_gray(Laplace,Tmp3,Tmp4,'max','and',MinG,999999)
threshold(Laplace,Tmp5,-999999,-Threshold)
connection(Tmp5,Tmp6)
select_shape(Tmp6,Tmp7,'area','and',MinS,999999)
select_gray(Laplace,Tmp7,Tmp8,'min','and',-999999,-MinG)
concat_obj(Tmp4,Tmp8,Result)
* Edge detection with the Laplace operator (and edge thinning)
diff_of_gauss(Image,Laplace,2.0,1.6)
* find "`positive"' and "`negative"' regions:
dual_threshold(Laplace,Region,20,2,1)
* The zero runnings are the complement to these image section:
complement(Region,ZeroCrossings)
* Simulation of dual_threshold
dual_threshold(Laplace,Result,MinS,MinG,Threshold)
threshold(Laplace,Tmp1,Threshold,999999)
connection(Tmp1,Tmp2)
select_shape(Tmp2,Tmp3,'area','and',MinS,999999)
select_gray(Laplace,Tmp3,Tmp4,'max','and',MinG,999999)
threshold(Laplace,Tmp5,-999999,-Threshold)
connection(Tmp5,Tmp6)
select_shape(Tmp6,Tmp7,'area','and',MinS,999999)
select_gray(Laplace,Tmp7,Tmp8,'min','and',-999999,-MinG)
concat_obj(Tmp4,Tmp8,Result)
dual_thresholddual_thresholddual_thresholdDualThresholdDualThreshold 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_systemset_systemSetSystemSetSystem.
If necessary, an exception is raised.
min_max_graymin_max_graymin_max_grayMinMaxGrayMinMaxGray,
sobel_ampsobel_ampsobel_ampSobelAmpSobelAmp,
binomial_filterbinomial_filterbinomial_filterBinomialFilterBinomialFilter,
gauss_imagegauss_imagegauss_imageGaussImageGaussImage,
reduce_domainreduce_domainreduce_domainReduceDomainReduceDomain,
diff_of_gaussdiff_of_gaussdiff_of_gaussDiffOfGaussDiffOfGauss,
sub_imagesub_imagesub_imageSubImageSubImage,
derivate_gaussderivate_gaussderivate_gaussDerivateGaussDerivateGauss,
laplace_of_gausslaplace_of_gausslaplace_of_gaussLaplaceOfGaussLaplaceOfGauss,
laplacelaplacelaplaceLaplaceLaplace,
expand_regionexpand_regionexpand_regionExpandRegionExpandRegion
connectionconnectionconnectionConnectionConnection,
dilation1dilation1dilation1Dilation1Dilation1,
erosion1erosion1erosion1Erosion1Erosion1,
openingopeningopeningOpeningOpening,
closingclosingclosingClosingClosing,
rank_regionrank_regionrank_regionRankRegionRankRegion,
shape_transshape_transshape_transShapeTransShapeTrans,
skeletonskeletonskeletonSkeletonSkeleton
thresholdthresholdthresholdThresholdThreshold,
dyn_thresholddyn_thresholddyn_thresholdDynThresholdDynThreshold,
check_differencecheck_differencecheck_differenceCheckDifferenceCheckDifference
connectionconnectionconnectionConnectionConnection,
select_shapeselect_shapeselect_shapeSelectShapeSelectShape,
select_grayselect_grayselect_graySelectGraySelectGray
Foundation
| HALCON Reference Manual 10.0.2 |
Copyright © 1996-2011 MVTec Software GmbH |