halcon使用点拟合圆形时候,点集顺序紊乱,不影响圆形拟合效果

read_image (Image, '截图20201226094342972.bmp')
* Matching 01: BEGIN of generated code for model initialization
set_system ('border_shape_models', 'false')
* Matching 01: Obtain the model image
* Matching 01: The image is assumed to be made available in the
* Matching 01: variable last displayed in the graphics window
copy_obj (Image, Image, 1, 1)
* Matching 01: build the ROI from basic regions
gen_rectangle1 (ModelRegion, 28.468, 280.863, 93.22, 334.675)
* Matching 01: reduce the model template
reduce_domain (Image, ModelRegion, TemplateImage)
* Matching 01: create the shape model
create_shape_model (TemplateImage, 3, rad(0), rad(0), rad(4.1992), ['none','no_pregeneration'], 'use_polarity', [10,11,4], 7, ModelId)
* Matching 01: get the model contour for transforming it later into the image
get_shape_model_contours (ModelContours, ModelId, 1)
* Matching 01: END of generated code for model initialization
* Matching 01: BEGIN of generated code for model application
* Matching 01: the following operations are usually moved into
* Matching 01: that loop where the aquired images are processed
* Matching 01: Find the model
find_shape_model (Image, ModelId, rad(0), rad(0), 0.5, 0, 0.5, 'least_squares', [3,1], 0.75, ModelRow, ModelColumn, ModelAngle, ModelScore)
* Matching 01: transform the model contours into the detected positions
for MatchingObjIdx := 0 to |ModelScore| - 1 by 1
    hom_mat2d_identity (HomMat)
    hom_mat2d_rotate (HomMat, ModelAngle[MatchingObjIdx], 0, 0, HomMat)
    hom_mat2d_translate (HomMat, ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], HomMat)
    affine_trans_contour_xld (ModelContours, TransContours, HomMat)
    dev_display (TransContours)
endfor



gen_contour_polygon_xld (Contour, ModelRow, ModelColumn)


fit_circle_contour_xld (Contour, 'algebraic', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)

gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, 6.28318, 'positive', 1)

* Matching 01: Clear model when done
clear_shape_model (ModelId)
* Matching 01: END of generated code for model application

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/cashmood/article/details/111715371
今日推荐