KlassenKlassenKlassenKlassen | | | | Operatoren

min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray (Operator)

Name

min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray — Minimale und maximale Grauwerte innerhalb von Regionen.

Signatur

min_max_gray(Regions, Image : : Percent : Min, Max, Range)

Herror min_max_gray(const Hobject Regions, const Hobject Image, double Percent, double* Min, double* Max, double* Range)

Herror T_min_max_gray(const Hobject Regions, const Hobject Image, const Htuple Percent, Htuple* Min, Htuple* Max, Htuple* Range)

Herror min_max_gray(Hobject Regions, Hobject Image, const HTuple& Percent, double* Min, double* Max, double* Range)

Herror min_max_gray(Hobject Regions, Hobject Image, const HTuple& Percent, HTuple* Min, HTuple* Max, HTuple* Range)

double HRegion::MinMaxGray(const HImage& Image, const HTuple& Percent, double* Max, double* Range) const

HTuple HRegionArray::MinMaxGray(const HImage& Image, const HTuple& Percent, HTuple* Max, HTuple* Range) const

void MinMaxGray(const HObject& Regions, const HObject& Image, const HTuple& Percent, HTuple* Min, HTuple* Max, HTuple* Range)

void HImage::MinMaxGray(const HRegion& Regions, const HTuple& Percent, HTuple* Min, HTuple* Max, HTuple* Range) const

void HImage::MinMaxGray(const HRegion& Regions, double Percent, double* Min, double* Max, double* Range) const

void HRegion::MinMaxGray(const HImage& Image, const HTuple& Percent, HTuple* Min, HTuple* Max, HTuple* Range) const

void HRegion::MinMaxGray(const HImage& Image, double Percent, double* Min, double* Max, double* Range) const

void HOperatorSetX.MinMaxGray(
[in] IHUntypedObjectX* Regions, [in] IHUntypedObjectX* Image, [in] VARIANT Percent, [out] VARIANT* Min, [out] VARIANT* Max, [out] VARIANT* Range)

VARIANT HImageX.MinMaxGray(
[in] IHRegionX* Regions, [in] VARIANT Percent, [out] VARIANT* Max, [out] VARIANT* Range)

VARIANT HRegionX.MinMaxGray(
[in] IHImageX* Image, [in] VARIANT Percent, [out] VARIANT* Max, [out] VARIANT* Range)

static void HOperatorSet.MinMaxGray(HObject regions, HObject image, HTuple percent, out HTuple min, out HTuple max, out HTuple range)

void HImage.MinMaxGray(HRegion regions, HTuple percent, out HTuple min, out HTuple max, out HTuple range)

void HImage.MinMaxGray(HRegion regions, double percent, out double min, out double max, out double range)

void HRegion.MinMaxGray(HImage image, HTuple percent, out HTuple min, out HTuple max, out HTuple range)

void HRegion.MinMaxGray(HImage image, double percent, out double min, out double max, out double range)

Beschreibung

min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray erstellt das Histogramm der absoluten Häufigkeiten der Grauwerte innerhalb von RegionsRegionsRegionsRegionsRegionsregions im Eingabebild ImageImageImageImageImageimage (siehe gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto) und berechnet die Anzahl der Bildpunkte, die PercentPercentPercentPercentPercentpercent der Fläche des Eingabebildes entspricht. Daraufhin wird auf beiden Seiten des Histogramms um diese Anzahl von Bildpunkten nach innen gegangen und der kleinste und größte Grauwert bestimmt:

  z.B.:
    Fläche = 60, Prozent = 5, d.h. 3 Bildpunkte
    Histogramm = [2,8,0,7,13,0,0,...,0,10,10,5,3,1,1]
    => Maximum = 255, Minimum = 0, Spanne = 255

    min_max_gray liefert: Maximum = 253, Minimum = 1, Spanne = 252

Für Bilder vom Typ int4, int8 und real wird die obige Berechnung nicht über Histogramme sondern über Selektion des entsprechenden Grauwertes durchgeführt. Wird PercentPercentPercentPercentPercentpercent auf 50 gesetzt, dann ist MinMinMinMinMinmin = MaxMaxMaxMaxMaxmax = Median. Wenn PercentPercentPercentPercentPercentpercent gleich 0 ist, dann wird kein Histogramm berechnet, um die Laufzeit zu verbessern.

Achtung

Der Operator min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray berücksichtigt nur die mittels RegionsRegionsRegionsRegionsRegionsregions übergebenen Regionen und ignoriert jede Domäne, die zuvor für das Eingabebild ImageImageImageImageImageimage festgelegt wurde.

Parallelisierung

Parameter

RegionsRegionsRegionsRegionsRegionsregions (input_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject

Regionen, deren Merkmale berechnet werden sollen.

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

Grauwertdaten.

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

Prozentsatz unterhalb (oberhalb) des absoluten Maximums (Minimums).

Defaultwert: 0

Wertevorschläge: 0, 1, 2, 5, 7, 10, 15, 20, 30, 40, 50

Restriktion: 0 <= Percent && Percent <= 50

MinMinMinMinMinmin (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

„Minimaler“ Grauwert.

MaxMaxMaxMaxMaxmax (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

„Maximaler“ Grauwert.

Zusicherung: Max >= Min

RangeRangeRangeRangeRangerange (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Differenz aus Max und Min.

Zusicherung: Range >= 0

Beispiel (HDevelop)

* Threshold segmentation with training region:
read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
min_max_gray(Region,Image,5,Min,Max,Range)
threshold(Image,SegmentedRegion,Min,Max)
dev_display(SegmentedRegion)

Beispiel (C)

/* Threshold segmentation with training region: */
read_image(&Image,"fabrik");
draw_region(&Region,WindowHandle);
min_max_gray(Region,Image,5.0,&Min,&Max,NULL);
threshold(Image,&SegmentedRegion,Min,Max);
disp_region(SegmentedRegion,WindowHandle);

Beispiel (HDevelop)

* Threshold segmentation with training region:
read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
min_max_gray(Region,Image,5,Min,Max,Range)
threshold(Image,SegmentedRegion,Min,Max)
dev_display(SegmentedRegion)

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

#include "HalconCpp.h"
using namespace Halcon;
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif

main()
{
  HImage   img ("fabrik");
  HWindow  w;

  Htuple   range, max;

  img.Display (w);
  w.Click ();

  HRegion   reg = w.DrawRegion ();
  HImage    rdd = img.ReduceDomain (reg);

  Htuple min = reg.MinMaxGray (rdd, 5, &max, &range);

  HRegionArray imgseg = ((img >= min[0].I()).Connection() &
                         (img <= max[0].I()).Connection());

  cout << "Min = " << min[0].I() << endl;
  cout << "Max = " << max[0].I() << endl;

  imgseg.Display (w);
  w.Click ();
  return(0);
}

Beispiel (HDevelop)

* Threshold segmentation with training region:
read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
min_max_gray(Region,Image,5,Min,Max,Range)
threshold(Image,SegmentedRegion,Min,Max)
dev_display(SegmentedRegion)

Beispiel (HDevelop)

* Threshold segmentation with training region:
read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
min_max_gray(Region,Image,5,Min,Max,Range)
threshold(Image,SegmentedRegion,Min,Max)
dev_display(SegmentedRegion)

Ergebnis

min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray liefert den Wert 2 (H_MSG_TRUE), falls das Eingabebild definierte Grauwerte besitzt und die Parameter korrekt sind. Das Verhalten bei leerer Eingabe (keine Eingabebilder) wird mit set_system(::'no_object_result',<Result>:)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>), das bei leerer Region mit set_system(::'empty_region_result',<Result>:)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>) festgelegt. Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

draw_regiondraw_regionDrawRegiondraw_regionDrawRegionDrawRegion, gen_circlegen_circleGenCirclegen_circleGenCircleGenCircle, gen_ellipsegen_ellipseGenEllipsegen_ellipseGenEllipseGenEllipse, gen_rectangle1gen_rectangle1GenRectangle1gen_rectangle1GenRectangle1GenRectangle1, thresholdthresholdThresholdthresholdThresholdThreshold, regiongrowingregiongrowingRegiongrowingregiongrowingRegiongrowingRegiongrowing

Nachfolger

thresholdthresholdThresholdthresholdThresholdThreshold

Alternativen

select_grayselect_graySelectGrayselect_graySelectGraySelectGray, intensityintensityIntensityintensityIntensityIntensity

Siehe auch

gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto, scale_imagescale_imageScaleImagescale_imageScaleImageScaleImage, scale_image_maxscale_image_maxScaleImageMaxscale_image_maxScaleImageMaxScaleImageMax, learn_ndim_normlearn_ndim_normLearnNdimNormlearn_ndim_normLearnNdimNormLearnNdimNorm

Modul

Foundation


KlassenKlassenKlassenKlassen | | | | Operatoren