create_bead_inspection_modelT_create_bead_inspection_modelCreateBeadInspectionModelCreateBeadInspectionModelcreate_bead_inspection_model (算子)

名称

create_bead_inspection_modelT_create_bead_inspection_modelCreateBeadInspectionModelCreateBeadInspectionModelcreate_bead_inspection_model — 创建模型以检查图像中的胶珠或粘合剂。

签名

create_bead_inspection_model(BeadContour : : TargetThickness, ThicknessTolerance, PositionTolerance, Polarity, GenParamName, GenParamValue : BeadInspectionModel)

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 CreateBeadInspectionModel(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)

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)

static void HOperatorSet.CreateBeadInspectionModel(HObject beadContour, HTuple targetThickness, HTuple thicknessTolerance, HTuple positionTolerance, HTuple polarity, HTuple genParamName, HTuple genParamValue, out HTuple beadInspectionModel)

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(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)

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

描述

create_bead_inspection_modelcreate_bead_inspection_modelCreateBeadInspectionModelCreateBeadInspectionModelCreateBeadInspectionModelcreate_bead_inspection_model 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.

算子 create_bead_inspection_modelcreate_bead_inspection_modelCreateBeadInspectionModelCreateBeadInspectionModelCreateBeadInspectionModelcreate_bead_inspection_model returns a handle to the bead inspection model in BeadInspectionModelBeadInspectionModelBeadInspectionModelBeadInspectionModelbeadInspectionModelbead_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 BeadContourBeadContourBeadContourBeadContourbeadContourbead_contour. Such a contour can be generated, e.g., by using the operators gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXldGenContourPolygonXldgen_contour_polygon_xld or gen_contour_nurbs_xldgen_contour_nurbs_xldGenContourNurbsXldGenContourNurbsXldGenContourNurbsXldgen_contour_nurbs_xld。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_polygondraw_polygonDrawPolygonDrawPolygonDrawPolygondraw_polygon or draw_nurbsdraw_nurbsDrawNurbsDrawNurbsDrawNurbsdraw_nurbs). To inspect beads consisting of multiple parts, multiple models must be created.

Mandatory parameters

image/svg+xml TargetThickness ThicknessTolerance
( 1)
image/svg+xml PositionTolerance BeadInspectionModel
( 2)
The mandatory parameters for a bead inspection model

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

- TargetThicknessTargetThicknessTargetThicknessTargetThicknesstargetThicknesstarget_thickness: defines the optimal bead thickness in pixels.

- ThicknessToleranceThicknessToleranceThicknessToleranceThicknessTolerancethicknessTolerancethickness_tolerance: defines the tolerance to the bead's thickness in pixels. The bead is accepted if its thickness is within the range:

[TargetThicknessTargetThicknessTargetThicknessTargetThicknesstargetThicknesstarget_thickness-ThicknessToleranceThicknessToleranceThicknessToleranceThicknessTolerancethicknessTolerancethickness_tolerance, TargetThicknessTargetThicknessTargetThicknessTargetThicknesstargetThicknesstarget_thickness+ThicknessToleranceThicknessToleranceThicknessToleranceThicknessTolerancethicknessTolerancethickness_tolerance]

- PositionTolerancePositionTolerancePositionTolerancePositionTolerancepositionToleranceposition_tolerance: defines the tolerance to the bead's position in pixels. The 'bead position' is the center of the detected bead. The bead is accepted if the distance between its center and the contour's position is less than the PositionTolerancePositionTolerancePositionTolerancePositionTolerancepositionToleranceposition_tolerance

- PolarityPolarityPolarityPolaritypolaritypolarity: defines the polarity of the bead in the images to inspect. 'light'"light""light""light""light""light" if the bead is lighter than its background, 'dark'"dark""dark""dark""dark""dark" otherwise.

Edge extraction parameters

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

The following parameters can be set for GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name

'sigma'"sigma""sigma""sigma""sigma""sigma"

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

默认值: 2.0

'threshold'"threshold""threshold""threshold""threshold""threshold"

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

默认值: 30

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

执行信息

此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。

此算子修改后续输入参数的状态:

在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。

参数

BeadContourBeadContourBeadContourBeadContourbeadContourbead_contour (输入对象)  xld objectHXLDHObjectHXLDHobject

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

TargetThicknessTargetThicknessTargetThicknessTargetThicknesstargetThicknesstarget_thickness (输入控制)  integer HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Optimal bead thickness.

默认值: 50

值范围: 5 ≤ TargetThickness TargetThickness TargetThickness TargetThickness targetThickness target_thickness

ThicknessToleranceThicknessToleranceThicknessToleranceThicknessTolerancethicknessTolerancethickness_tolerance (输入控制)  integer HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Tolerance of bead's thickness with respect to TargetThicknessTargetThicknessTargetThicknessTargetThicknesstargetThicknesstarget_thickness

默认值: 15

值范围: 0 ≤ ThicknessTolerance ThicknessTolerance ThicknessTolerance ThicknessTolerance thicknessTolerance thickness_tolerance

PositionTolerancePositionTolerancePositionTolerancePositionTolerancepositionToleranceposition_tolerance (输入控制)  integer HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Tolerance of the bead's center position.

默认值: 15

值范围: 0 ≤ PositionTolerance PositionTolerance PositionTolerance PositionTolerance positionTolerance position_tolerance

PolarityPolarityPolarityPolaritypolaritypolarity (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

The bead's polarity.

默认值: 'light' "light" "light" "light" "light" "light"

值列表: 'dark'"dark""dark""dark""dark""dark", 'light'"light""light""light""light""light"

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制)  attribute.name(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

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

默认值: []

值列表: 'sigma'"sigma""sigma""sigma""sigma""sigma", 'threshold'"threshold""threshold""threshold""threshold""threshold"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制)  attribute.value(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

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

默认值: []

建议值: 0.6, 1.0, 4.0, 5.0, 10.0, 50.0

BeadInspectionModelBeadInspectionModelBeadInspectionModelBeadInspectionModelbeadInspectionModelbead_inspection_model (output_control, state is modified)  bead_inspection_model HBeadInspectionModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle for using and accessing the bead inspection model.

示例(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)

结果

算子 create_bead_inspection_modelcreate_bead_inspection_modelCreateBeadInspectionModelCreateBeadInspectionModelCreateBeadInspectionModelcreate_bead_inspection_model 在给定参数有效且在可接受范围内时返回值 2 ( H_MSG_TRUE )。 否则,将抛出异常。

可能的前趋

gen_contour_nurbs_xldgen_contour_nurbs_xldGenContourNurbsXldGenContourNurbsXldGenContourNurbsXldgen_contour_nurbs_xld, gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXldGenContourPolygonXldgen_contour_polygon_xld

可能的后继

apply_bead_inspection_modelapply_bead_inspection_modelApplyBeadInspectionModelApplyBeadInspectionModelApplyBeadInspectionModelapply_bead_inspection_model, set_bead_inspection_paramset_bead_inspection_paramSetBeadInspectionParamSetBeadInspectionParamSetBeadInspectionParamset_bead_inspection_param

另见

clear_bead_inspection_modelclear_bead_inspection_modelClearBeadInspectionModelClearBeadInspectionModelClearBeadInspectionModelclear_bead_inspection_model

模块

二维计量