Name
bin_thresholdbin_thresholdBinThresholdbin_thresholdBinThresholdBinThreshold — Segment an image using an automatically determined
threshold.
Warning
bin_thresholdbin_thresholdBinThresholdbin_thresholdBinThresholdBinThreshold is obsolete and is only provided for
reasons of backward compatibility. New applications should use
the operator binary_thresholdbinary_thresholdBinaryThresholdbinary_thresholdBinaryThresholdBinaryThreshold instead.
Herror bin_threshold(const Hobject Image, Hobject* Region)
Herror T_bin_threshold(const Hobject Image, Hobject* Region)
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.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
- Automatically parallelized on internal data level.
Dark regions of the image.
read_image (Image, 'letters')
bin_threshold (Image, Seg)
connection (Seg, Connected)
read_image(&Image,"letters");
bin_threshold(Image,&Seg);
connection(Seg,&Connected);
set_shape(WindowHandle,"rectangle1");
set_colored(WindowHandle,6);
disp_region(Connected,WindowHandle);
read_image (Image, 'letters')
bin_threshold (Image, Seg)
connection (Seg, Connected)
#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;
}
read_image (Image, 'letters')
bin_threshold (Image, Seg)
connection (Seg, Connected)
read_image (Image, 'letters')
bin_threshold (Image, Seg)
connection (Seg, Connected)
Foundation