KlassenKlassenKlassenKlassen | | | | Operatoren

thresholdthresholdThresholdthresholdThresholdThreshold (Operator)

Name

thresholdthresholdThresholdthresholdThresholdThreshold — Segmentieren mit globalen Schwellenwerten.

Signatur

threshold(Image : Region : MinGray, MaxGray : )

Herror threshold(const Hobject Image, Hobject* Region, double MinGray, double MaxGray)

Herror T_threshold(const Hobject Image, Hobject* Region, const Htuple MinGray, const Htuple MaxGray)

Herror threshold(Hobject Image, Hobject* Region, const HTuple& MinGray, const HTuple& MaxGray)

HRegion HImage::Threshold(const HTuple& MinGray, const HTuple& MaxGray) const

HRegionArray HImageArray::Threshold(const HTuple& MinGray, const HTuple& MaxGray) const

void Threshold(const HObject& Image, HObject* Region, const HTuple& MinGray, const HTuple& MaxGray)

HRegion HImage::Threshold(const HTuple& MinGray, const HTuple& MaxGray) const

HRegion HImage::Threshold(double MinGray, double MaxGray) const

void HOperatorSetX.Threshold(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*Region, [in] VARIANT MinGray, [in] VARIANT MaxGray)

IHRegionX* HImageX.Threshold(
[in] VARIANT MinGray, [in] VARIANT MaxGray)

static void HOperatorSet.Threshold(HObject image, out HObject region, HTuple minGray, HTuple maxGray)

HRegion HImage.Threshold(HTuple minGray, HTuple maxGray)

HRegion HImage.Threshold(double minGray, double maxGray)

Beschreibung

thresholdthresholdThresholdthresholdThresholdThreshold wählt aus den Eingabebildern die Bildpunkte aus, deren Grauwerte g der Schwellenwertbedingung

genügen.

Alle Punkte eines Eingabebildes, die die Bedingung erfüllen, werden gemeinsam als eine neue Region abgespeichert. Wird mehr als ein Grauwertbereich übergeben (Tupel von Werten für MinGrayMinGrayMinGrayMinGrayMinGrayminGray und MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray), dann wird für jedes dieser Intervalle eine Region erzeugt. Für Vektorfeldbilder wird der Schwellwert nicht auf Grauwerte sondern auf die Länge der Vektoren angewandt.

Achtung

Für ganzzahlige Bildtypen werden Fließkommawerte in MinGrayMinGrayMinGrayMinGrayMinGrayminGray und MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray abgeschnitten.

Parallelisierung

Parameter

ImageImageImageImageImageimage (input_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / vector_field)

Eingabebild.

RegionRegionRegionRegionRegionregion (output_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject *

Segmentierte Region.

MinGrayMinGrayMinGrayMinGrayMinGrayminGray (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Untere Schwelle für die Grauwerte.

Defaultwert: 128.0

Wertevorschläge: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0

MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray (input_control)  number(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Obere Schwelle für die Grauwerte.

Defaultwert: 255.0

Wertevorschläge: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0

Restriktion: MaxGray >= MinGray

Beispiel (HDevelop)

read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)

Beispiel (C)

read_image(&Image,"fabrik");
sobel_amp(Image,&EdgeAmp,"sum_abs",3);
threshold(EdgeAmp,&Seg,50.0,255.0);
skeleton(Seg,&Rand);
connection(Rand,&Lines);
select_shape(Lines,&Edges,"area","and",10.0,1000000.0);

Beispiel (HDevelop)

read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)

Beispiel (C++ (HALCON 5.0-10.0))

#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 != 4)
  {
    cout << "Usage : " << argv[0] << " 'image' MinGray MaxGray" << endl;
    return (-1);
  }

  HImage   image (argv[1]),
           Sobel;
  HWindow  win;

  image.Display (win);

  int MinGray = atoi (argv[2]);
  int MaxGray = atoi (argv[3]);

  Sobel = image.SobelAmp ("sum_abs", 3);

  HRegionArray rand  = ((image >= MinGray) & (image <= MaxGray)).Skeleton();
  HRegionArray lines = rand.Connection();
  HRegionArray edges = lines.SelectShape("area", "and", 10.0, 10000000.0);

  edges.Display (win);
  win.Click ();

  return (0);
}

Beispiel (HDevelop)

read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)

Beispiel (HDevelop)

read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)

Komplexität

Sei A die Fläche der Eingaberegion, dann ist die Laufzeitkomplexität O(A).

Ergebnis

thresholdthresholdThresholdthresholdThresholdThreshold liefert den Wert 2 (H_MSG_TRUE), falls die Parameter korrekt sind. 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.

Vorgänger

histo_to_threshhisto_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh, min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray, sobel_ampsobel_ampSobelAmpsobel_ampSobelAmpSobelAmp, binomial_filterbinomial_filterBinomialFilterbinomial_filterBinomialFilterBinomialFilter, gauss_filtergauss_filterGaussFiltergauss_filterGaussFilterGaussFilter, reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain, fill_interlacefill_interlaceFillInterlacefill_interlaceFillInterlaceFillInterlace

Nachfolger

connectionconnectionConnectionconnectionConnectionConnection, dilation1dilation1Dilation1dilation1Dilation1Dilation1, erosion1erosion1Erosion1erosion1Erosion1Erosion1, openingopeningOpeningopeningOpeningOpening, closingclosingClosingclosingClosingClosing, rank_regionrank_regionRankRegionrank_regionRankRegionRankRegion, shape_transshape_transShapeTransshape_transShapeTransShapeTrans, skeletonskeletonSkeletonskeletonSkeletonSkeleton

Alternativen

class_2dim_supclass_2dim_supClass2dimSupclass_2dim_supClass2dimSupClass2dimSup, hysteresis_thresholdhysteresis_thresholdHysteresisThresholdhysteresis_thresholdHysteresisThresholdHysteresisThreshold, dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold, binary_thresholdbinary_thresholdBinaryThresholdbinary_thresholdBinaryThresholdBinaryThreshold, char_thresholdchar_thresholdCharThresholdchar_thresholdCharThresholdCharThreshold, auto_thresholdauto_thresholdAutoThresholdauto_thresholdAutoThresholdAutoThreshold, dual_thresholddual_thresholdDualThresholddual_thresholdDualThresholdDualThreshold

Siehe auch

zero_crossingzero_crossingZeroCrossingzero_crossingZeroCrossingZeroCrossing, background_segbackground_segBackgroundSegbackground_segBackgroundSegBackgroundSeg, regiongrowingregiongrowingRegiongrowingregiongrowingRegiongrowingRegiongrowing

Modul

Foundation


KlassenKlassenKlassenKlassen | | | | Operatoren