HALCON Reference Manual 10.0.2
Table of Contents / Segmentation / Threshold ClassesClassesClasses | | | Operators

zero_crossing_sub_pixzero_crossing_sub_pixzero_crossing_sub_pixZeroCrossingSubPixZeroCrossingSubPix (Operator)

Name

zero_crossing_sub_pixzero_crossing_sub_pixzero_crossing_sub_pixZeroCrossingSubPixZeroCrossingSubPix — Extract zero crossings from an image with subpixel accuracy.

Signature

zero_crossing_sub_pix(Image : ZeroCrossings : : )

Herror zero_crossing_sub_pix(const Hobject Image, Hobject* ZeroCrossings)

Herror T_zero_crossing_sub_pix(const Hobject Image, Hobject* ZeroCrossings)

Herror zero_crossing_sub_pix(Hobject Image, Hobject* ZeroCrossings)

HXLDContArray HImage::ZeroCrossingSubPix() const

void HOperatorSetX.ZeroCrossingSubPix(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*ZeroCrossings)

IHXLDContX* HImageX.ZeroCrossingSubPix()

static void HOperatorSet.ZeroCrossingSubPix(HObject image, out HObject zeroCrossings)

HXLDCont HImage.ZeroCrossingSubPix()

Description

zero_crossing_sub_pixzero_crossing_sub_pixzero_crossing_sub_pixZeroCrossingSubPixZeroCrossingSubPix extracts the zero crossings of the input image ImageImageImageImageimage with subpixel accuracy. The extracted zero crossings are returned as XLD-contours in ZeroCrossingsZeroCrossingsZeroCrossingsZeroCrossingszeroCrossings. Thus, zero_crossing_sub_pixzero_crossing_sub_pixzero_crossing_sub_pixZeroCrossingSubPixZeroCrossingSubPix can be used as a sub-pixel precise edge extractor if the input image is a Laplace-filtered image (see laplacelaplacelaplaceLaplaceLaplace, laplace_of_gausslaplace_of_gausslaplace_of_gaussLaplaceOfGaussLaplaceOfGauss, derivate_gaussderivate_gaussderivate_gaussDerivateGaussDerivateGauss).

For the extraction, the input image is regarded as a surface, in which the gray values are interpolated bilinearly between the centers of the individual pixels. Consistent with the surface thus defined, zero crossing lines are extracted for each pixel and linked into topologically sound contours. This means that the zero crossing contours are correctly split at junction points. If the image contains extended areas of constant gray value 0, only the border of such areas is returned as zero crossings.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageXHobject (int1 / int2 / int4 / real)

Input image.

ZeroCrossingsZeroCrossingsZeroCrossingsZeroCrossingszeroCrossings (output_object)  xld_cont-array objectHXLDContHXLDContArrayHXLDContXHobject *

Extracted zero crossings.

Example (HDevelop)

* Detection zero crossings of the Laplacian-of-Gaussian
* of an aerial image
read_image(Image,'mreut')
derivate_gauss(Image,Laplace,3,'laplace')
zero_crossing_sub_pix(Laplace,ZeroCrossings)
disp_xld(ZeroCrossings,WindowHandle)

* Detection of edges, i.e, zero crossings of the Laplacian-of-Gaussian
* that have a large gradient magnitude, in an aerial image
read_image(Image,'mreut')
Sigma := 1.5
* Compensate the threshold for the fact that derivate_gauss(...,'gradient')
* calculates a Gaussian-smoothed gradient, in which the edge amplitudes
* are too small because of the Gaussian smoothing, to correspond to a true
* edge amplitude of 20.
Threshold := 20/(Sigma*sqrt(2*3.1415926))
derivate_gauss(Image,Gradient,Sigma,'gradient')
threshold(Gradient,Region,Threshold,255)
reduce_domain(Image,Region,ImageReduced)
derivate_gauss(ImageReduced,Laplace,Sigma,'laplace')
zero_crossing_sub_pix(Laplace,Edges)
disp_xld(Edges,WindowHandle)

Example (C)

/* Detection zero crossings of the Laplacian-of-Gaussian of aerial image */
read_image(&Image,"mreut");
derivate_gauss(Image,&Laplace,3,"laplace");
zero_crossing_sub_pix(Laplace,&ZeroCrossings);
disp_xld(ZeroCrossings,WindowHandle);

/* Detection of edges, i.e, zero crossings of the Laplacian-of-Gaussian
   that have a large gradient magnitude, in an aerial image */
read_image(&Image,"mreut");
Sigma = 1.5;
/* Compensate the threshold for the fact that derivate_gauss(...,'gradient')
   calculates a Gaussian-smoothed gradient, in which the edge amplitudes
   are too small because of the Gaussian smoothing, to correspond to a true
   edge amplitude of 20. */
Threshold = 20/(Sigma*sqrt(2*PI));
derivate_gauss(Image,&Gradient,Sigma,"gradient");
threshold(Gradient,&Region,Threshold,255);
reduce_domain(Image,Region,&ImageReduced);
derivate_gauss(ImageReduced,&Laplace,Sigma,"laplace");
zero_crossing_sub_pix(Laplace,&Edges);
disp_xld(Edges,WindowHandle);

Example (C++)

/* Detection zero crossings of the Laplacian-of-Gaussian of aerial image */
HWindow Window(0,0,512,512);
HImage Image("mreut");
HImage Laplace = Image.DerivateGauss(3,"laplace");
HXLDContArray ZeroCrossings = Laplace.ZeroCrossingsSubPix();
ZeroCrossings.Display(Window);

/* Detection of edges, i.e, zero crossings of the Laplacian-of-Gaussian
   that have a large gradient magnitude, in an aerial image */
HWindow Window(0,0,512,512);
HImage Image("mreut");
Sigma = 1.5;
/* Compensate the threshold for the fact that derivate_gauss(...,'gradient')
   calculates a Gaussian-smoothed gradient, in which the edge amplitudes
   are too small because of the Gaussian smoothing, to correspond to a true
   edge amplitude of 20. */
Threshold = 20/(Sigma*sqrt(2*PI));
HImage Gradient = Image.DerivateGauss(Sigma,"gradient");
HRegion Region = Gradient.Threshold(Threshold,255);
HImage ImageReduced = Image.ReduceDomain(Region);
HImage Laplace = ImageReduced.DerivateGauss(Sigma,"laplace");
HXLDContArray Edges = Laplace.ZeroCrossingSubPix();
Edges.Display(Window);

Example (HDevelop)

* Detection zero crossings of the Laplacian-of-Gaussian
* of an aerial image
read_image(Image,'mreut')
derivate_gauss(Image,Laplace,3,'laplace')
zero_crossing_sub_pix(Laplace,ZeroCrossings)
disp_xld(ZeroCrossings,WindowHandle)

* Detection of edges, i.e, zero crossings of the Laplacian-of-Gaussian
* that have a large gradient magnitude, in an aerial image
read_image(Image,'mreut')
Sigma := 1.5
* Compensate the threshold for the fact that derivate_gauss(...,'gradient')
* calculates a Gaussian-smoothed gradient, in which the edge amplitudes
* are too small because of the Gaussian smoothing, to correspond to a true
* edge amplitude of 20.
Threshold := 20/(Sigma*sqrt(2*3.1415926))
derivate_gauss(Image,Gradient,Sigma,'gradient')
threshold(Gradient,Region,Threshold,255)
reduce_domain(Image,Region,ImageReduced)
derivate_gauss(ImageReduced,Laplace,Sigma,'laplace')
zero_crossing_sub_pix(Laplace,Edges)
disp_xld(Edges,WindowHandle)

Example (HDevelop)

* Detection zero crossings of the Laplacian-of-Gaussian
* of an aerial image
read_image(Image,'mreut')
derivate_gauss(Image,Laplace,3,'laplace')
zero_crossing_sub_pix(Laplace,ZeroCrossings)
disp_xld(ZeroCrossings,WindowHandle)

* Detection of edges, i.e, zero crossings of the Laplacian-of-Gaussian
* that have a large gradient magnitude, in an aerial image
read_image(Image,'mreut')
Sigma := 1.5
* Compensate the threshold for the fact that derivate_gauss(...,'gradient')
* calculates a Gaussian-smoothed gradient, in which the edge amplitudes
* are too small because of the Gaussian smoothing, to correspond to a true
* edge amplitude of 20.
Threshold := 20/(Sigma*sqrt(2*3.1415926))
derivate_gauss(Image,Gradient,Sigma,'gradient')
threshold(Gradient,Region,Threshold,255)
reduce_domain(Image,Region,ImageReduced)
derivate_gauss(ImageReduced,Laplace,Sigma,'laplace')
zero_crossing_sub_pix(Laplace,Edges)
disp_xld(Edges,WindowHandle)

Result

zero_crossing_sub_pixzero_crossing_sub_pixzero_crossing_sub_pixZeroCrossingSubPixZeroCrossingSubPix usually returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

laplacelaplacelaplaceLaplaceLaplace, laplace_of_gausslaplace_of_gausslaplace_of_gaussLaplaceOfGaussLaplaceOfGauss, diff_of_gaussdiff_of_gaussdiff_of_gaussDiffOfGaussDiffOfGauss, derivate_gaussderivate_gaussderivate_gaussDerivateGaussDerivateGauss

Alternatives

zero_crossingzero_crossingzero_crossingZeroCrossingZeroCrossing

See also

threshold_sub_pixthreshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPix

Module

2D Metrology


Table of Contents / Segmentation / Threshold ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH