create_metrology_model

set_system ('border_shape_models', 'false')

read_image (Image, 'D:/图像文件/调试图片/调试图片/cam220230726182355309.bmp')

* draw_rectangle2 (3600, Row4, Column5, Phi3, Length12, Length22)

Rect1Row:=1010.37

Rect1Col:=1189.15

phi:=-0.188

RectLength1:=450.531

RectLength2:=499

* draw_rectangle2 (3600, Row, Column, Phi, Length1, Length2)

Row:=1010.37

Column:=1189

Phi:=-0.188

Length1:=450

Length2:=499

gen_cross_contour_xld (Cross, Rect1Row, Rect1Col, 60, 0.785398)

ratio := 90.045/1.5708

angle := ratio*phi

* HHH:=rad(-angle)

HHH:=rad(phi)

gen_rectangle2 (ModelRegion, Rect1Row, Rect1Col, rad(phi), RectLength1, RectLength2)

gen_rectangle2 (Rectangle,Row, Column, rad(Phi), Length1, Length2)

hom_mat2d_identity (HomMat2DIdentity)

hom_mat2d_rotate (HomMat2DIdentity,HHH,Rect1Row, Rect1Col, HomMat2DRotate)

affine_trans_region (Rectangle, RegionAffineTrans1, HomMat2DRotate, 'nearest_neighbor')

affine_trans_image (Image, ImageAffinTrans, HomMat2DRotate, 'constant', 'false')

area_center (RegionAffineTrans1, Area, Row6, Column7)

gen_contour_region_xld (RegionAffineTrans1, Contours1, 'border')

orientation_region (RegionAffineTrans1, Phi1)

Row1M:=Row6-Rect1Row

Column1M:=Rect1Col-Column7

gen_rectangle2 (ModelRegion1, Rect1Row, Rect1Col, 0, RectLength1, RectLength2)

reduce_domain (ImageAffinTrans, ModelRegion1, TemplateImage)

create_shape_model (TemplateImage, 7,0, 360, 'auto', ['point_reduction_high','no_pregeneration'], 'use_polarity', [33,49,7], 3, ModelId)

get_shape_model_contours (ModelContours, ModelId, 1)

hom_mat2d_identity (HomMat2DIdentity)

hom_mat2d_rotate (HomMat2DIdentity,rad(phi), Rect1Row, Rect1Col,HomMat2DRotate)

hom_mat2d_translate (HomMat2DRotate, Rect1Row, Rect1Col, HomMat2DTranslate)

affine_trans_contour_xld (ModelContours, ShapeModelTrans, HomMat2DTranslate)

read_image (Image1,'D:/图像文件/调试图片/调试图片/cam220230726182355309.bmp')

find_shape_model (Image1, ModelId, 0, 360, 0.7, 0, 0.5, 'least_squares', [7,1], 0.7, ModelRow, ModelColumn, ModelAngle, ModelScore)

for MatchingObjIdx := 0 to |ModelScore| - 1 by 1

hom_mat2d_identity (HomMat)

hom_mat2d_translate (HomMat, ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], HomMat2DTranslate)

hom_mat2d_rotate (HomMat2DTranslate, ModelAngle[MatchingObjIdx], ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], HomMat2DRotate)

affine_trans_contour_xld (ModelContours, ShapeModelTrans, HomMat2DRotate)

endfor

affine_trans_pixel (HomMat2DRotate,Row1M,Column1M, Rect1RowCheck, Rect1ColCheck)

create_metrology_model (MetrologyHandle)

add_metrology_object_rectangle2_measure (MetrologyHandle,Rect1RowCheck, Rect1ColCheck,rad(Phi1)+ModelAngle, Length1, Length2, 5, 2, 1, 2, [], [], Index2)

set_metrology_object_param (MetrologyHandle, 'all', 'num_measures',25)

apply_metrology_model (Image1, MetrologyHandle)

get_metrology_object_measures (Contours, MetrologyHandle, 'all', 'all', Row3, Column3)

dev_display (Contours)

get_metrology_object_result (MetrologyHandle, 'all', 'all', 'result_type', 'all_param', Parameter)

gen_rectangle2 (Rectangle1, Parameter[0], Parameter[1], Parameter[2], Parameter[3], Parameter[4])

get_metrology_object_result_contour (Contour, MetrologyHandle,'all', 'all', 1.5)

clear_shape_model (ModelId)

相关推荐
捕鲸叉11 分钟前
C++设计模式和编程框架两种设计元素的比较与相互关系
开发语言·c++·设计模式
未知陨落1 小时前
数据结构——二叉搜索树
开发语言·数据结构·c++·二叉搜索树
大波V51 小时前
设计模式-参考的雷丰阳老师直播课
java·开发语言·设计模式
无敌最俊朗@1 小时前
unity3d————接口基础知识点
开发语言·c#
一丝晨光2 小时前
gcc 1.c和g++ 1.c编译阶段有什么区别?如何知道g++编译默认会定义_GNU_SOURCE?
c语言·开发语言·c++·gnu·clang·gcc·g++
南城花随雪。2 小时前
Spring框架之装饰者模式 (Decorator Pattern)
java·开发语言·装饰器模式
究极无敌暴龙战神X2 小时前
前端学习之ES6+
开发语言·javascript·ecmascript
虞书欣的62 小时前
Python小游戏24——小恐龙躲避游戏
开发语言·python·游戏·小程序·pygame
FHYAAAX2 小时前
【机器学习】任务十:从函数分析到机器学习应用与BP神经网络
开发语言·python
汉克老师2 小时前
GESP4级考试语法知识(贪心算法(四))
开发语言·c++·算法·贪心算法·图论·1024程序员节