ClassesClassesClassesClasses | | | | Operators

expand_domain_grayexpand_domain_grayExpandDomainGrayexpand_domain_grayExpandDomainGrayExpandDomainGray (Operator)

Name

expand_domain_grayexpand_domain_grayExpandDomainGrayexpand_domain_grayExpandDomainGrayExpandDomainGray — Expand the domain of an image and set the gray values in the expanded domain.

Signature

expand_domain_gray(InputImage : ExpandedImage : ExpansionRange : )

Herror expand_domain_gray(const Hobject InputImage, Hobject* ExpandedImage, const Hlong ExpansionRange)

Herror T_expand_domain_gray(const Hobject InputImage, Hobject* ExpandedImage, const Htuple ExpansionRange)

Herror expand_domain_gray(Hobject InputImage, Hobject* ExpandedImage, const HTuple& ExpansionRange)

HImage HImage::ExpandDomainGray(const HTuple& ExpansionRange) const

HImageArray HImageArray::ExpandDomainGray(const HTuple& ExpansionRange) const

void ExpandDomainGray(const HObject& InputImage, HObject* ExpandedImage, const HTuple& ExpansionRange)

HImage HImage::ExpandDomainGray(Hlong ExpansionRange) const

void HOperatorSetX.ExpandDomainGray(
[in] IHUntypedObjectX* InputImage, [out] IHUntypedObjectX*ExpandedImage, [in] VARIANT ExpansionRange)

IHImageX* HImageX.ExpandDomainGray([in] Hlong ExpansionRange)

static void HOperatorSet.ExpandDomainGray(HObject inputImage, out HObject expandedImage, HTuple expansionRange)

HImage HImage.ExpandDomainGray(int expansionRange)

Description

expand_domain_grayexpand_domain_grayExpandDomainGrayexpand_domain_grayExpandDomainGrayExpandDomainGray expands the border gray values of the domain outwards. The width of the expansion is set by the parameter ExpansionRangeExpansionRangeExpansionRangeExpansionRangeExpansionRangeexpansionRange. All filters in HALCON use gray values of the pixels outside the domain depending on the filter width. This may lead to undesirable side effects especially in the border region of the domain. For example, if the foreground (domain) and the background of the image differ strongly in brightness, the result of a filter operation may lead to undesired darkening or brightening at the border of the domain. In order to avoid this drawback, the domain is expanded by expand_domain_grayexpand_domain_grayExpandDomainGrayexpand_domain_grayExpandDomainGrayExpandDomainGray in a preliminary stage, copying the gray values of the border pixels to the outside of the domain. In addition, the domain itself is also expanded to reflect the newly set pixels. Therefore, in many cases it is reasonable to reduce the domain again (reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain or change_domainchange_domainChangeDomainchange_domainChangeDomainChangeDomain) after using expand_domain_grayexpand_domain_grayExpandDomainGrayexpand_domain_grayExpandDomainGrayExpandDomainGray and call the filter operation afterwards. ExpansionRangeExpansionRangeExpansionRangeExpansionRangeExpansionRangeexpansionRange should be set to the half of the filter width.

Attention

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Parallelization

Parameters

InputImageInputImageInputImageInputImageInputImageinputImage (input_object)  (multichannel-)image(-array) objectHImageHImageHImageHImageXHobject (byte / int1 / int2 / uint2 / int4 / real)

Input image with domain to be expanded.

ExpandedImageExpandedImageExpandedImageExpandedImageExpandedImageexpandedImage (output_object)  image(-array) objectHImageHImageHImageHImageXHobject * (byte / int1 / int2 / uint2 / int4 / real)

Output image with new gray values in the expanded domain.

ExpansionRangeExpansionRangeExpansionRangeExpansionRangeExpansionRangeexpansionRange (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Radius of the gray value expansion, measured in pixels.

Default value: 2

Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16

Restriction: ExpansionRange >= 1

Example (HDevelop)

read_image(Fabrik, 'fabrik')
gen_rectangle2(Rectangle_Label,243,320,-1.55,62,28)
reduce_domain(Fabrik, Rectangle_Label, Fabrik_Label)
* Character extraction without gray value expansion:
mean_image(Fabrik_Label,Label_Mean_normal,31,31)
dyn_threshold(Fabrik_Label,Label_Mean_normal,Characters_normal,10,'dark')
dev_display(Fabrik)
dev_display(Characters_normal)
* The characters in the border region are not extracted !
stop()
* Character extraction with gray value expansion:
expand_domain_gray(Fabrik_Label, Label_expanded,15)
reduce_domain(Label_expanded,Rectangle_Label, Label_expanded_reduced)
mean_image(Label_expanded_reduced,Label_Mean_expanded,31,31)
dyn_threshold(Fabrik_Label,Label_Mean_expanded,\
              Characters_expanded,10,'dark')
dev_display(Fabrik)
dev_display(Characters_expanded)
* Now, even in the border region the characters are recognized

Complexity

Let L the perimeter of the domain. Then the runtime complexity is approximately O(L)*ExpansionRangeExpansionRangeExpansionRangeExpansionRangeExpansionRangeexpansionRange.

Result

expand_domain_grayexpand_domain_grayExpandDomainGrayexpand_domain_grayExpandDomainGrayExpandDomainGray returns 2 (H_MSG_TRUE) if all parameters are correct. If necessary, an exception is raised.

Possible Predecessors

reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain

Possible Successors

reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain, mean_imagemean_imageMeanImagemean_imageMeanImageMeanImage, dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold

See also

reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain, mean_imagemean_imageMeanImagemean_imageMeanImageMeanImage

Module

Foundation


ClassesClassesClassesClasses | | | | Operators