ClassesClassesClassesClasses | | | | Operators

gray_histoT_gray_histoGrayHistogray_histoGrayHistoGrayHisto (Operator)

Name

gray_histoT_gray_histoGrayHistogray_histoGrayHistoGrayHisto — Calculate the gray value distribution.

Signature

gray_histo(Regions, Image : : : AbsoluteHisto, RelativeHisto)

Herror T_gray_histo(const Hobject Regions, const Hobject Image, Htuple* AbsoluteHisto, Htuple* RelativeHisto)

Herror gray_histo(Hobject Regions, Hobject Image, HTuple* AbsoluteHisto, HTuple* RelativeHisto)

HTuple HRegion::GrayHisto(const HImage& Image, HTuple* RelativeHisto) const

HTuple HRegionArray::GrayHisto(const HImage& Image, HTuple* RelativeHisto) const

void GrayHisto(const HObject& Regions, const HObject& Image, HTuple* AbsoluteHisto, HTuple* RelativeHisto)

HTuple HImage::GrayHisto(const HRegion& Regions, HTuple* RelativeHisto) const

HTuple HRegion::GrayHisto(const HImage& Image, HTuple* RelativeHisto) const

void HOperatorSetX.GrayHisto(
[in] IHUntypedObjectX* Regions, [in] IHUntypedObjectX* Image, [out] VARIANT* AbsoluteHisto, [out] VARIANT* RelativeHisto)

VARIANT HImageX.GrayHisto(
[in] IHRegionX* Regions, [out] VARIANT* RelativeHisto)

VARIANT HRegionX.GrayHisto(
[in] IHImageX* Image, [out] VARIANT* RelativeHisto)

static void HOperatorSet.GrayHisto(HObject regions, HObject image, out HTuple absoluteHisto, out HTuple relativeHisto)

HTuple HImage.GrayHisto(HRegion regions, out HTuple relativeHisto)

HTuple HRegion.GrayHisto(HImage image, out HTuple relativeHisto)

Description

The operator gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto calculates for the image (ImageImageImageImageImageimage) within RegionsRegionsRegionsRegionsRegionsregions the absolute (AbsoluteHistoAbsoluteHistoAbsoluteHistoAbsoluteHistoAbsoluteHistoabsoluteHisto) and relative (RelativeHistoRelativeHistoRelativeHistoRelativeHistoRelativeHistorelativeHisto) histogram of the gray values.

Both histograms are tupels of 256 values, which --- beginning at 0 --- contain the frequencies of the individual gray values of the image.

AbsoluteHistoAbsoluteHistoAbsoluteHistoAbsoluteHistoAbsoluteHistoabsoluteHisto indicates the absolute frequencies of the gray values in integers, and RelativeHistoRelativeHistoRelativeHistoRelativeHistoRelativeHistorelativeHisto indicates the relative, i.e. the absolute frequencies divided by the area of the image as floating point numbers.

'real'"real""real""real""real""real"-, 'int2'"int2""int2""int2""int2""int2"-, 'uint2'"uint2""uint2""uint2""uint2""uint2"-, and 'int4'"int4""int4""int4""int4""int4"-images are transformed into 'byte'"byte""byte""byte""byte""byte"-images (first the largest and smallest gray value in the image are determined, and then the original gray values are mapped linearly into the area 0..255) and then processed as mentioned above. The histogram can also be returned directly as a graphic via the operators set_paint(::WindowHandle,'histogram':)set_paint(WindowHandle,"histogram")SetPaint(WindowHandle,"histogram")set_paint(WindowHandle,"histogram")SetPaint(WindowHandle,"histogram")SetPaint(WindowHandle,"histogram") and disp_imagedisp_imageDispImagedisp_imageDispImageDispImage.

Attention

Note that the operator gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto only considers the given RegionsRegionsRegionsRegionsRegionsregions and ignores any previously set domain of the input image ImageImageImageImageImageimage.

Real, int2, uint2, and int4 images are reduced to 256 gray values.

gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto can be executed on OpenCL devices for byte, int1, directional and cyclic images if the OpenCL device supports the cl_khr_local_int32_base_atomics and cl_khr_global_int32_base_atomics extensions (which are optional in OpenCL 1.0). Unlike most other HALCON operators, gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto can be substantially slower on an OpenCL device if the ImageImageImageImageImageimage is not completely included in the RegionsRegionsRegionsRegionsRegionsregions.

OpenCL support is not available in HALCON XL, as 64 bit atomic integer arithmetic would be required.

Parallelization

Parameters

RegionsRegionsRegionsRegionsRegionsregions (input_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject

Region in which the histogram is to be calculated.

ImageImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageHImageXHobject (byte* / cyclic* / direction* / int1* / int2 / uint2 / int4 / real) *allowed for compute devices

Image the gray value distribution of which is to be calculated.

AbsoluteHistoAbsoluteHistoAbsoluteHistoAbsoluteHistoAbsoluteHistoabsoluteHisto (output_control)  histogram-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Absolute frequencies of the gray values.

RelativeHistoRelativeHistoRelativeHistoRelativeHistoRelativeHistorelativeHisto (output_control)  histogram-array HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Frequencies, normalized to the area of the region.

Complexity

If F is the area of the region the runtime complexity is O(F + 255).

Result

The operator gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto returns the value 2 (H_MSG_TRUE) if the image has defined gray values and the parameters are correct. The behavior in case of empty input (no input images available) is set via the operator 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>), the behavior in case of empty region is set via 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>). If necessary an exception is raised.

Possible Successors

histo_to_threshhisto_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh, gen_region_histogen_region_histoGenRegionHistogen_region_histoGenRegionHistoGenRegionHisto

Alternatives

min_max_graymin_max_grayMinMaxGraymin_max_grayMinMaxGrayMinMaxGray, intensityintensityIntensityintensityIntensityIntensity, gray_histo_absgray_histo_absGrayHistoAbsgray_histo_absGrayHistoAbsGrayHistoAbs, gray_histo_rangegray_histo_rangeGrayHistoRangegray_histo_rangeGrayHistoRangeGrayHistoRange

See also

set_paintset_paintSetPaintset_paintSetPaintSetPaint, disp_imagedisp_imageDispImagedisp_imageDispImageDispImage, histo_2dimhisto_2dimHisto2dimhisto_2dimHisto2dimHisto2dim, scale_image_maxscale_image_maxScaleImageMaxscale_image_maxScaleImageMaxScaleImageMax, entropy_grayentropy_grayEntropyGrayentropy_grayEntropyGrayEntropyGray

Module

Foundation


ClassesClassesClassesClasses | | | | Operators