Name
thresholdthresholdThresholdthresholdThresholdThreshold — Segment an image using global threshold.
thresholdthresholdThresholdthresholdThresholdThreshold selects the pixels from the input image
whose gray values g fulfill the following condition:
All points of an image fulfilling the condition are returned as one
region. If more than one gray value interval is passed (tuples for
MinGrayMinGrayMinGrayMinGrayMinGrayminGray and MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray), one separate region is
returned for each interval. For vector field images, the threshold is
not applied to gray values but to the lengths of the vectors.
For input images of an integer type, floating point values in
MinGrayMinGrayMinGrayMinGrayMinGrayminGray and MaxGrayMaxGrayMaxGrayMaxGrayMaxGraymaxGray are truncated.
- 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.
Lower threshold for the gray values.
Default value: 128.0
Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0
Upper threshold for the gray values.
Default value: 255.0
Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0
Restriction: MaxGray >= MinGray
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
read_image(&Image,"fabrik");
sobel_amp(Image,&EdgeAmp,"sum_abs",3);
threshold(EdgeAmp,&Seg,50.0,255.0);
skeleton(Seg,&Rand);
connection(Rand,&Lines);
select_shape(Lines,&Edges,"area","and",10.0,1000000.0);
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
#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 != 4)
{
cout << "Usage : " << argv[0] << " 'image' MinGray MaxGray" << endl;
return (-1);
}
HImage image (argv[1]),
Sobel;
HWindow win;
image.Display (win);
int MinGray = atoi (argv[2]);
int MaxGray = atoi (argv[3]);
Sobel = image.SobelAmp ("sum_abs", 3);
HRegionArray rand = ((image >= MinGray) & (image <= MaxGray)).Skeleton();
HRegionArray lines = rand.Connection();
HRegionArray edges = lines.SelectShape("area", "and", 10.0, 10000000.0);
edges.Display (win);
win.Click ();
return (0);
}
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
Let A be the area of the input region. Then the runtime
complexity is O(A).
thresholdthresholdThresholdthresholdThresholdThreshold returns 2 (H_MSG_TRUE) if all parameters are correct.
The behavior with respect to the input images and output regions
can be determined by setting the values of the flags
'no_object_result'"no_object_result""no_object_result""no_object_result""no_object_result""no_object_result", 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result""empty_region_result", and
'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region""store_empty_region" with set_systemset_systemSetSystemset_systemSetSystemSetSystem.
If necessary, an exception is raised.
histo_to_threshhisto_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh,
min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray,
sobel_ampsobel_ampSobelAmpsobel_ampSobelAmpSobelAmp,
binomial_filterbinomial_filterBinomialFilterbinomial_filterBinomialFilterBinomialFilter,
gauss_filtergauss_filterGaussFiltergauss_filterGaussFilterGaussFilter,
reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain,
fill_interlacefill_interlaceFillInterlacefill_interlaceFillInterlaceFillInterlace
connectionconnectionConnectionconnectionConnectionConnection,
dilation1dilation1Dilation1dilation1Dilation1Dilation1,
erosion1erosion1Erosion1erosion1Erosion1Erosion1,
openingopeningOpeningopeningOpeningOpening,
closingclosingClosingclosingClosingClosing,
rank_regionrank_regionRankRegionrank_regionRankRegionRankRegion,
shape_transshape_transShapeTransshape_transShapeTransShapeTrans,
skeletonskeletonSkeletonskeletonSkeletonSkeleton
class_2dim_supclass_2dim_supClass2dimSupclass_2dim_supClass2dimSupClass2dimSup,
hysteresis_thresholdhysteresis_thresholdHysteresisThresholdhysteresis_thresholdHysteresisThresholdHysteresisThreshold,
dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold,
binary_thresholdbinary_thresholdBinaryThresholdbinary_thresholdBinaryThresholdBinaryThreshold,
char_thresholdchar_thresholdCharThresholdchar_thresholdCharThresholdCharThreshold,
auto_thresholdauto_thresholdAutoThresholdauto_thresholdAutoThresholdAutoThreshold,
dual_thresholddual_thresholdDualThresholddual_thresholdDualThresholdDualThreshold
zero_crossingzero_crossingZeroCrossingzero_crossingZeroCrossingZeroCrossing,
background_segbackground_segBackgroundSegbackground_segBackgroundSegBackgroundSeg,
regiongrowingregiongrowingRegiongrowingregiongrowingRegiongrowingRegiongrowing
Foundation