Skip to content

create_bead_inspection_modelCreateBeadInspectionModelCreateBeadInspectionModelcreate_bead_inspection_modelT_create_bead_inspection_model🔗

Short description🔗

create_bead_inspection_modelCreateBeadInspectionModelCreateBeadInspectionModelcreate_bead_inspection_modelT_create_bead_inspection_model — Create a model to inspect beads or adhesive in images.

Signature🔗

create_bead_inspection_model( xld BeadContour, integer TargetThickness, integer ThicknessTolerance, integer PositionTolerance, string Polarity, attribute.name GenParamName, attribute.value GenParamValue, out bead_inspection_model BeadInspectionModel )void CreateBeadInspectionModel( const HObject& BeadContour, const HTuple& TargetThickness, const HTuple& ThicknessTolerance, const HTuple& PositionTolerance, const HTuple& Polarity, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* BeadInspectionModel )static void HOperatorSet.CreateBeadInspectionModel( HObject beadContour, HTuple targetThickness, HTuple thicknessTolerance, HTuple positionTolerance, HTuple polarity, HTuple genParamName, HTuple genParamValue, out HTuple beadInspectionModel )def create_bead_inspection_model( bead_contour: HObject, target_thickness: Union[int, float], thickness_tolerance: Union[int, float], position_tolerance: Union[int, float], polarity: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_bead_inspection_model( const Hobject BeadContour, const Htuple TargetThickness, const Htuple ThicknessTolerance, const Htuple PositionTolerance, const Htuple Polarity, const Htuple GenParamName, const Htuple GenParamValue, Htuple* BeadInspectionModel )

void HBeadInspectionModel::HBeadInspectionModel( const HXLD& BeadContour, const HTuple& TargetThickness, const HTuple& ThicknessTolerance, const HTuple& PositionTolerance, const HString& Polarity, const HTuple& GenParamName, const HTuple& GenParamValue )

void HBeadInspectionModel::HBeadInspectionModel( const HXLD& BeadContour, Hlong TargetThickness, Hlong ThicknessTolerance, Hlong PositionTolerance, const HString& Polarity, const HString& GenParamName, Hlong GenParamValue )

void HBeadInspectionModel::HBeadInspectionModel( const HXLD& BeadContour, Hlong TargetThickness, Hlong ThicknessTolerance, Hlong PositionTolerance, const char* Polarity, const char* GenParamName, Hlong GenParamValue )

void HBeadInspectionModel::HBeadInspectionModel( const HXLD& BeadContour, Hlong TargetThickness, Hlong ThicknessTolerance, Hlong PositionTolerance, const wchar_t* Polarity, const wchar_t* GenParamName, Hlong GenParamValue ) (Windows only)

public HBeadInspectionModel( HXLD beadContour, HTuple targetThickness, HTuple thicknessTolerance, HTuple positionTolerance, string polarity, HTuple genParamName, HTuple genParamValue )

public HBeadInspectionModel( HXLD beadContour, int targetThickness, int thicknessTolerance, int positionTolerance, string polarity, string genParamName, int genParamValue )

void HBeadInspectionModel::CreateBeadInspectionModel( const HXLD& BeadContour, const HTuple& TargetThickness, const HTuple& ThicknessTolerance, const HTuple& PositionTolerance, const HString& Polarity, const HTuple& GenParamName, const HTuple& GenParamValue )

void HBeadInspectionModel::CreateBeadInspectionModel( const HXLD& BeadContour, Hlong TargetThickness, Hlong ThicknessTolerance, Hlong PositionTolerance, const HString& Polarity, const HString& GenParamName, Hlong GenParamValue )

void HBeadInspectionModel::CreateBeadInspectionModel( const HXLD& BeadContour, Hlong TargetThickness, Hlong ThicknessTolerance, Hlong PositionTolerance, const char* Polarity, const char* GenParamName, Hlong GenParamValue )

void HBeadInspectionModel::CreateBeadInspectionModel( const HXLD& BeadContour, Hlong TargetThickness, Hlong ThicknessTolerance, Hlong PositionTolerance, const wchar_t* Polarity, const wchar_t* GenParamName, Hlong GenParamValue ) (Windows only)

void HBeadInspectionModel.CreateBeadInspectionModel( HXLD beadContour, HTuple targetThickness, HTuple thicknessTolerance, HTuple positionTolerance, string polarity, HTuple genParamName, HTuple genParamValue )

void HBeadInspectionModel.CreateBeadInspectionModel( HXLD beadContour, int targetThickness, int thicknessTolerance, int positionTolerance, string polarity, string genParamName, int genParamValue )

Description🔗

create_bead_inspection_modelCreateBeadInspectionModel creates a model to inspect beads or adhesive in images.

The basic principle of bead inspection

The bead inspection operators enable the user to define a reference contour that indicates the position and shape of a bead or adhesive on a certain product. Images of such products can then be inspected to verify that a bead or adhesive exists at the positions defined by the contour and that it is of acceptable thickness. The images must already be aligned with the given contour.

The operator create_bead_inspection_modelCreateBeadInspectionModel returns a handle to the bead inspection model in BeadInspectionModelbeadInspectionModelbead_inspection_model, which can later be used to perform other operations related to bead inspection. These operations include the modification of the bead inspection model parameters and performing the inspection on input images as defined by the model.

Providing the model contour

In order to inspect beads, a contour serving as the model for the bead must be provided in BeadContourbeadContourbead_contour. Such a contour can be generated, e.g., by using the operators gen_contour_polygon_xldGenContourPolygonXld or gen_contour_nurbs_xldGenContourNurbsXld. The contour must be defined to be aligned to the beads in the input images. To achieve this, the user can draw the XLD directly on a reference image in the graphics window (with draw_polygonDrawPolygon or draw_nurbsDrawNurbs). To inspect beads consisting of multiple parts, multiple models must be created.

Mandatory parameters

 
(1)
(2)

The mandatory parameters for a bead inspection model

In order to inspect beads, the following parameters must be set:

Edge extraction parameters

Bead inspection relies on edge extraction to identify the edges of beads. Accordingly, correct initialization of the measure_posMeasurePos parameters helps improve bead inspection results.

The following parameters can be set for GenParamNamegenParamNamegen_param_name.

  • 'sigma'"sigma": Sets the standard deviation of the Gaussian smoothing kernel. The value of 'sigma'"sigma" depends on the quality of the images to be inspected, namely on the amount of noise.

    Default: 2.02.0

  • 'threshold'"threshold": Sets the minimum edge amplitude to be extracted. Setting a higher value for 'threshold'"threshold" helps to avoid the extraction of noise edges and select salient edges. 'threshold'"threshold" cannot be less than 11.

    Default: 3030

The Measure Assistant can be used to find suitable values for these two parameters.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters🔗

BeadContourbeadContourbead_contour (input_object) xld → objectHObjectHXLDHObjectHobject

XLD contour specifying the expected bead’s shape and position.

TargetThicknesstargetThicknesstarget_thickness (input_control) integer → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

Optimal bead thickness.

Default: 5050
Value range: 5 ≤ TargetThickness

ThicknessTolerancethicknessTolerancethickness_tolerance (input_control) integer → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

Tolerance of bead’s thickness with respect to TargetThicknesstargetThicknesstarget_thickness.

Default: 1515
Value range: 0 ≤ ThicknessTolerance

PositionTolerancepositionToleranceposition_tolerance (input_control) integer → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[int, float]Htuple (Hlong / double)

Tolerance of the bead’s center position.

Default: 1515
Value range: 0 ≤ PositionTolerance

Polaritypolaritypolarity (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

The bead’s polarity.

Default: 'light'"light"
List of values: 'dark', 'light'"dark", "light"

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Names of the generic parameters that can be adjusted for the bead inspection model.

Default: [][]
List of values: 'sigma', 'threshold'"sigma", "threshold"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value(-array) → (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)MaybeSequence[Union[int, float, str]]Htuple (Hlong / double / char*)

Values of the generic parameters that can be adjusted for the bead inspection model.

Default: [][]
Suggested values: 0.6, 1.0, 4.0, 5.0, 10.0, 50.00.6, 1.0, 4.0, 5.0, 10.0, 50.0

BeadInspectionModelbeadInspectionModelbead_inspection_model (output_control, state is modified) bead_inspection_model → (handle)HTuple (HHandle)HBeadInspectionModel, HTuple (IntPtr)HHandleHtuple (handle)

Handle for using and accessing the bead inspection model.

Example🔗

(HDevelop)


* Read the image of the bead to be inspected.
read_image (Image, 'bead/adhesive_bead_01')
* Define the reference path of the adhesive beads.
gen_contour_nurbs_xld (ContourRef, \
                       [610.974,533.443,461.763,393.009,330.106,287.683, \
                        270.129,265.74,265.74,300.849,331.569,376.917, \
                        438.357,489.557,539.294], \
                       [418.581,424.27,439.441,473.574,526.67,574.078, \
                        644.241,708.715,765.604,818.7,866.107,915.411, \
                        966.611,998.848,993.159], \
                       'auto', \
                       [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15], \
                       3, 1, 5)
*
* Create the bead inspection model, identifying the bead's parameters
create_bead_inspection_model (ContourRef, 14, 7, 30, 'dark', [], [], \
                               BeadInspectionModel)
*
* Apply the bead inspection model to the image
apply_bead_inspection_model (Image, LeftContour, RightContour, \
                              ErrorSegment, BeadInspectionModel, \
                              ErrorType)

Result🔗

The operator create_bead_inspection_modelCreateBeadInspectionModel returns the value 2 (H_MSG_TRUE) if the given parameters are valid and within acceptable range. Otherwise, an exception will be raised.

Combinations with other operators🔗

Combinations

Possible predecessors

gen_contour_nurbs_xldGenContourNurbsXld, gen_contour_polygon_xldGenContourPolygonXld

Possible successors

apply_bead_inspection_modelApplyBeadInspectionModel, set_bead_inspection_paramSetBeadInspectionParam

See also

clear_bead_inspection_modelClearBeadInspectionModel

Module🔗

2D Metrology