HALCON Reference Manual 10.0.2
Table of Contents / Segmentation / Threshold ClassesClassesClasses | | | Operators

bin_thresholdbin_thresholdbin_thresholdBinThresholdBinThreshold (Operator)

Name

bin_thresholdbin_thresholdbin_thresholdBinThresholdBinThreshold — Segment an image using an automatically determined threshold.

Signature

bin_threshold(Image : Region : : )

Herror bin_threshold(const Hobject Image, Hobject* Region)

Herror T_bin_threshold(const Hobject Image, Hobject* Region)

Herror bin_threshold(Hobject Image, Hobject* Region)

HRegion HImage::BinThreshold() const

HRegionArray HImageArray::BinThreshold() const

void HOperatorSetX.BinThreshold(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*Region)

IHRegionX* HImageX.BinThreshold()

static void HOperatorSet.BinThreshold(HObject image, out HObject region)

HRegion HImage.BinThreshold()

Description

bin_thresholdbin_thresholdbin_thresholdBinThresholdBinThreshold segments a single-channel gray value image using an automatically determined threshold. First, the relative histogram of the gray values is determined. Then, relevant minima are extracted from the histogram, which are used as parameters for a thresholding operation. In order to reduce the number of minima, the histogram is smoothed with a Gaussian, as in auto_thresholdauto_thresholdauto_thresholdAutoThresholdAutoThreshold. The mask size is enlarged until there is only one minimum in the smoothed histogram. The selected region contains the pixels with gray values from 0 to the minimum or for real images from the smallest value to the respective minimum. This operator is, for example useful for the segmentation of dark characters on a light paper.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  image(-array) objectHImageHImageHImageXHobject (byte / uint2 / real)

Input image.

RegionRegionRegionRegionregion (output_object)  region(-array) objectHRegionHRegionHRegionXHobject *

Dark regions of the image.

Example (HDevelop)

read_image (Image, 'letters')
bin_threshold (Image, Seg)
connection (Seg, Connected)

Example (C)

read_image(&Image,"letters");
bin_threshold(Image,&Seg);
connection(Seg,&Connected);
set_shape(WindowHandle,"rectangle1");
set_colored(WindowHandle,6);
disp_region(Connected,WindowHandle);

Example (C++)

#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.SetShape("rectangle1");
  w.SetColored(12);

  image.Display(w);

  HRegionArray reg = image.BinThreshold();
  HRegionArray con = reg.Connection();

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

  return 0;
}

Example (HDevelop)

read_image (Image, 'letters')
bin_threshold (Image, Seg)
connection (Seg, Connected)

Example (HDevelop)

read_image (Image, 'letters')
bin_threshold (Image, Seg)
connection (Seg, Connected)

Possible Predecessors

anisotropic_diffusionanisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusion, median_imagemedian_imagemedian_imageMedianImageMedianImage, illuminateilluminateilluminateIlluminateIlluminate

Possible Successors

connectionconnectionconnectionConnectionConnection, select_shapeselect_shapeselect_shapeSelectShapeSelectShape, select_grayselect_grayselect_graySelectGraySelectGray

Alternatives

auto_thresholdauto_thresholdauto_thresholdAutoThresholdAutoThreshold, char_thresholdchar_thresholdchar_thresholdCharThresholdCharThreshold

See also

gray_histogray_histogray_histoGrayHistoGrayHisto, smooth_funct_1d_gausssmooth_funct_1d_gausssmooth_funct_1d_gaussSmoothFunct1dGaussSmoothFunct1dGauss, thresholdthresholdthresholdThresholdThreshold

Module

Foundation


Table of Contents / Segmentation / Threshold ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH