Name
dual_thresholddual_thresholdDualThresholddual_thresholdDualThresholdDualThreshold — Segmentieren mit Schwellen für Bilder mit Vorzeichen.
dual_thresholddual_thresholdDualThresholddual_thresholdDualThresholdDualThreshold segmentiert das Eingabebild in eine
Teilregion mit Grauwerten >= Threshold („positive“ Bildbereiche) und eine mit
Grauwerten <= -Threshold
(„negative“ Bildbereiche). Nur „positive“ oder „negative“
Teilbereiche mit einer Fläche größer als MinSizeMinSizeMinSizeMinSizeMinSizeminSize werden dabei
berücksichtigt. Teilbereiche, deren maximaler Grauwert
betragsmäßig kleiner ist als MinGrayMinGrayMinGrayMinGrayMinGrayminGray, werden unterdrückt.
Die durchgeführte Segmentation ist nicht vollständig, d.h. die
„positiven“ und „negativen“ Ergebnisregionen überdecken
zusammengenommen nicht unbedingt das ganze Eingabebild. Es bleiben
alle Bildbereiche unberücksichtigt, deren Grauwerte zwischen
-Threshold und ThresholdThresholdThresholdThresholdThresholdthreshold (bzw.
-MinGrayMinGrayMinGrayMinGrayMinGrayminGray und MinGrayMinGrayMinGrayMinGrayMinGrayminGray) liegen.
dual_thresholddual_thresholdDualThresholddual_thresholdDualThresholdDualThreshold schließt sich typischerweise an die Anwendung
von Laplace-Operatoren wie (laplacelaplaceLaplacelaplaceLaplaceLaplace,
laplace_of_gausslaplace_of_gaussLaplaceOfGausslaplace_of_gaussLaplaceOfGaussLaplaceOfGauss, derivate_gaussderivate_gaussDerivateGaussderivate_gaussDerivateGaussDerivateGauss oder
diff_of_gaussdiff_of_gaussDiffOfGaussdiff_of_gaussDiffOfGaussDiffOfGauss) oder eine Bildsubtraktion (sub_imagesub_imageSubImagesub_imageSubImageSubImage)
an. In den Nulldurchgängen des Laplace-Operators spiegeln sich
Bildkanten wider, die sich als Trennlinien zwischen den
„positiven“ und „negativen“ Bildbereichen bestimmen lassen.
Dazu ruft man zuerst dual_thresholddual_thresholdDualThresholddual_thresholdDualThresholdDualThreshold mit ThresholdThresholdThresholdThresholdThresholdthreshold =
1 auf und erzeugt dann die komplementäre Regionen mittels
complementcomplementComplementcomplementComplementComplement. Der Parameter MinGrayMinGrayMinGrayMinGrayMinGrayminGray steuert dabei
die Rauschinvarianz,während MinSizeMinSizeMinSizeMinSizeMinSizeminSize das Auflösungsvermögen
der Kantendetektion steuert.
Bei Pixeltypen ohne Vorzeichen (byte) wird nur die positive Hälfte
der Segmentation durchgeführt. dual_thresholddual_thresholdDualThresholddual_thresholdDualThresholdDualThreshold verhält sich
also wie eine einfaches Schwellenwertverfahren (thresholdthresholdThresholdthresholdThresholdThreshold)
mit nachgeschaltetem connectionconnectionConnectionconnectionConnectionConnection und select_grayselect_graySelectGrayselect_graySelectGraySelectGray.
- Multithreading-Typ: reentrant (läuft parallel zu nicht-exklusiven Operatoren).
- Multithreading-Bereich: global (kann von jedem Thread aufgerufen werden).
- Automatisch parallelisiert auf Tupelebene.
- Automatisch parallelisiert auf interner Datenebene.
„Positive“ und „negative“ Teilregionen.
Teilregionen mit weniger als MinSize Fläche werden
unterdrückt.
Defaultwert: 20
Wertevorschläge: 0, 10, 20, 50, 100, 200, 500, 1000
Typischer Wertebereich: 0
≤
MinSize
MinSize
MinSize
MinSize
MinSize
minSize
≤
10000 (lin)
Minimale Schrittweite: 1
Empfohlene Schrittweite: 10
Teilregionen, deren maximaler Grauwert betragsmäßig
kleiner als MinGray ist, werden unterdrückt.
Defaultwert: 5.0
Wertevorschläge: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 11.0, 15.0, 20.0
Typischer Wertebereich: 0.001
≤
MinGray
MinGray
MinGray
MinGray
MinGray
minGray
≤
10000.0 (lin)
Minimale Schrittweite: 1.0
Empfohlene Schrittweite: 10.0
Restriktion: MinGray > 0
Zurückgeliefert werden Teilregionen, deren Grauwerte
größer gleich (bzw. kleiner gleich) Threshold
(-Threshold) sind.
Defaultwert: 2.0
Wertevorschläge: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 11.0, 15.0, 20.0
Typischer Wertebereich: 0.001
≤
Threshold
Threshold
Threshold
Threshold
Threshold
threshold
≤
10000.0 (lin)
Minimale Schrittweite: 1.0
Empfohlene Schrittweite: 10.0
Restriktion: 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) ;
* 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)
#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_thresholdDualThresholddual_thresholdDualThresholdDualThreshold liefert normalerweise den Wert 2 (H_MSG_TRUE).
Für das Verhalten bzgl. der Eingabebilder und Ausgaberegionen sind
die Flags 'no_object_result'"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""empty_region_result" und 'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region""store_empty_region"
einstellbar (siehe set_systemset_systemSetSystemset_systemSetSystemSetSystem). Gegebenenfalls wird
eine Fehlerbehandlung durchgeführt.
min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray,
sobel_ampsobel_ampSobelAmpsobel_ampSobelAmpSobelAmp,
binomial_filterbinomial_filterBinomialFilterbinomial_filterBinomialFilterBinomialFilter,
gauss_imagegauss_imageGaussImagegauss_imageGaussImageGaussImage,
reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain,
diff_of_gaussdiff_of_gaussDiffOfGaussdiff_of_gaussDiffOfGaussDiffOfGauss,
sub_imagesub_imageSubImagesub_imageSubImageSubImage,
derivate_gaussderivate_gaussDerivateGaussderivate_gaussDerivateGaussDerivateGauss,
laplace_of_gausslaplace_of_gaussLaplaceOfGausslaplace_of_gaussLaplaceOfGaussLaplaceOfGauss,
laplacelaplaceLaplacelaplaceLaplaceLaplace,
expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion
connectionconnectionConnectionconnectionConnectionConnection,
dilation1dilation1Dilation1dilation1Dilation1Dilation1,
erosion1erosion1Erosion1erosion1Erosion1Erosion1,
openingopeningOpeningopeningOpeningOpening,
closingclosingClosingclosingClosingClosing,
rank_regionrank_regionRankRegionrank_regionRankRegionRankRegion,
shape_transshape_transShapeTransshape_transShapeTransShapeTrans,
skeletonskeletonSkeletonskeletonSkeletonSkeleton
thresholdthresholdThresholdthresholdThresholdThreshold,
dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold,
check_differencecheck_differenceCheckDifferencecheck_differenceCheckDifferenceCheckDifference
connectionconnectionConnectionconnectionConnectionConnection,
select_shapeselect_shapeSelectShapeselect_shapeSelectShapeSelectShape,
select_grayselect_graySelectGrayselect_graySelectGraySelectGray
Foundation