KlassenKlassenKlassenKlassen | | | | Operatoren

auto_thresholdauto_thresholdAutoThresholdauto_thresholdAutoThresholdAutoThreshold (Operator)

Name

auto_thresholdauto_thresholdAutoThresholdauto_thresholdAutoThresholdAutoThreshold — Segmentieren mit Schwellen aus dem Histogramm.

Signatur

auto_threshold(Image : Regions : Sigma : )

Herror auto_threshold(const Hobject Image, Hobject* Regions, double Sigma)

Herror T_auto_threshold(const Hobject Image, Hobject* Regions, const Htuple Sigma)

Herror auto_threshold(Hobject Image, Hobject* Regions, const HTuple& Sigma)

HRegionArray HImage::AutoThreshold(const HTuple& Sigma) const

HRegionArray HImageArray::AutoThreshold(const HTuple& Sigma) const

void AutoThreshold(const HObject& Image, HObject* Regions, const HTuple& Sigma)

HRegion HImage::AutoThreshold(const HTuple& Sigma) const

HRegion HImage::AutoThreshold(double Sigma) const

void HOperatorSetX.AutoThreshold(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*Regions, [in] VARIANT Sigma)

IHRegionX* HImageX.AutoThreshold([in] VARIANT Sigma)

static void HOperatorSet.AutoThreshold(HObject image, out HObject regions, HTuple sigma)

HRegion HImage.AutoThreshold(HTuple sigma)

HRegion HImage.AutoThreshold(double sigma)

Beschreibung

auto_thresholdauto_thresholdAutoThresholdauto_thresholdAutoThresholdAutoThreshold segmentiert ein einkanaliges Bild mittels mehrfacher Schwellenwertsegmentation. Als erstes wird dabei das absolute Histogramm über den Grauwerten ermittelt. Dann werden im Histogramm relevante Minima gesucht, die schließlich nacheinander als Schwellen für die Schwellenwertsegmentation dienen. Die Schwellen bestehen für Bilder vom Typ byte aus den Werten 0 und 255 und aus allen Minima des Histogramms (nach der Histogrammglättung mit einem Gaußfilter mit Standardabweichung SigmaSigmaSigmaSigmaSigmasigma). Für jedes Grauwertintervall wird eine Region erzeugt. Die Anzahl der Regionen ist die Anzahl der Minima + 1. Für Bilder vom Typ uint2 gilt das oben beschriebene analog. Allerdings ist es hier so, dass die höchste Schwelle 65535 beträgt. Weiterhin bezieht sich bei uint2-Bildern der Wert von SigmaSigmaSigmaSigmaSigmasigma (virtuell) auf ein Histogramm mit 256 Werten, obwohl intern Histogramme mit einer höheren Auflösung verwendet werden. Dies dient dazu, den Parameter SigmaSigmaSigmaSigmaSigmasigma bei der Umstellung zwischen Bildtypen nicht ändern zu müssen. Für float Bilder sind die Schwellwerte der minimale und maximale Grauwert aus dem Bild sowie alle Minima die aus dem Histogramm extrahiert wurden. Hier bezieht sich der Parameter SigmaSigmaSigmaSigmaSigmasigma auf die ursprünglichen Grauwerte. Um so größer der Wert von SigmaSigmaSigmaSigmaSigmasigma ist, um so weniger Regionen werden extrahiert. Das Verfahren ist dann einsetzbar, wenn die gesuchten Regionen einheitliche Grauwerte ausweisen (homogene Regionen).

Parallelisierung

Parameter

ImageImageImageImageImageimage (input_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject (byte / uint2 / real)

Eingabebild.

RegionsRegionsRegionsRegionsRegionsregions (output_object)  region-array objectHRegionHRegionHRegionArrayHRegionXHobject *

Regionen mit den Punkten innerhalb der Grauwertintervalle.

SigmaSigmaSigmaSigmaSigmasigma (input_control)  number HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Sigma für Gaußglättung des Histogramms.

Defaultwert: 2.0

Wertevorschläge: 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0

Typischer Wertebereich: 0.0 ≤ Sigma Sigma Sigma Sigma Sigma sigma ≤ 100.0 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.3

Restriktion: Sigma >= 0.0

Beispiel (HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

Beispiel (C)

read_image(&Image,"fabrik");
median_image(Image,&Median,"circle",3,"mirrored");
auto_threshold(Median,&Seg,2.0);
connection(Seg,&Connected);
set_colored(WindowHandle,12);
disp_obj(Connected,WindowHandle);

Beispiel (HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

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

  HImage       image(argv[1]);
  HImage       med;
  HWindow      w;

  w.SetDraw("margin");
  w.SetColored(12);

  image.Display (w);

  med = image.MedianImage("circle", 3, "mirrored");
  med.Display(w);

  HRegionArray reg = med.AutoThreshold(2.0);
  HRegionArray con = reg.Connection();

  cout << "Display image after AutoThreshold segmentation " << endl;
  con.Display(w);
  w.Click();

  return 0;
}

Beispiel (HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

Beispiel (HDevelop)

read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)

Vorgänger

anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusion, median_imagemedian_imageMedianImagemedian_imageMedianImageMedianImage, illuminateilluminateIlluminateilluminateIlluminateIlluminate

Nachfolger

connectionconnectionConnectionconnectionConnectionConnection, select_shapeselect_shapeSelectShapeselect_shapeSelectShapeSelectShape, select_grayselect_graySelectGrayselect_graySelectGraySelectGray

Alternativen

binary_thresholdbinary_thresholdBinaryThresholdbinary_thresholdBinaryThresholdBinaryThreshold, char_thresholdchar_thresholdCharThresholdchar_thresholdCharThresholdCharThreshold

Siehe auch

gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto, gray_histo_absgray_histo_absGrayHistoAbsgray_histo_absGrayHistoAbsGrayHistoAbs, histo_to_threshhisto_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh, smooth_funct_1d_gausssmooth_funct_1d_gaussSmoothFunct1dGausssmooth_funct_1d_gaussSmoothFunct1dGaussSmoothFunct1dGauss, thresholdthresholdThresholdthresholdThresholdThreshold

Modul

Foundation


KlassenKlassenKlassenKlassen | | | | Operatoren