ClassesClassesClassesClasses | | | | Operators

bin_thresholdbin_thresholdBinThresholdbin_thresholdBinThresholdBinThreshold (Operator)

Name

bin_thresholdbin_thresholdBinThresholdbin_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 BinThreshold(const HObject& Image, HObject* Region)

HRegion HImage::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_thresholdBinThresholdbin_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_thresholdAutoThresholdauto_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

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

Input image.

RegionRegionRegionRegionRegionregion (output_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject *

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 (HDevelop)

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

Example (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.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_diffusionAnisotropicDiffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusion, median_imagemedian_imageMedianImagemedian_imageMedianImageMedianImage, illuminateilluminateIlluminateilluminateIlluminateIlluminate

Possible Successors

connectionconnectionConnectionconnectionConnectionConnection, select_shapeselect_shapeSelectShapeselect_shapeSelectShapeSelectShape, select_grayselect_graySelectGrayselect_graySelectGraySelectGray

Alternatives

auto_thresholdauto_thresholdAutoThresholdauto_thresholdAutoThresholdAutoThreshold, char_thresholdchar_thresholdCharThresholdchar_thresholdCharThresholdCharThreshold

See also

gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto, smooth_funct_1d_gausssmooth_funct_1d_gaussSmoothFunct1dGausssmooth_funct_1d_gaussSmoothFunct1dGaussSmoothFunct1dGauss, thresholdthresholdThresholdthresholdThresholdThreshold

Module

Foundation


ClassesClassesClassesClasses | | | | Operators