得到ROI区域,组成的组件,以及多个样品组成的样品集
训练摸板组件train_model_components();
ModelImage:输入训练的模型的图像
InitialComponents:输入轮廓区域或封装区域的初始组件,区域
TrainingImage:用于培养模型组件的训练图像
ModelComponents:输出刚性模型组件的轮廓模型
ContrastLow:较低的滞后阈值
ContrastHigh:较高的滞后阈值
MinSize:最低多少像素成为一个了轮廓
MinScore:最低多少评分为找到该组件
SreachRowTol:搜索行方向公差
SreachColumTol:搜索列方向公差
SearchAngleTol:搜索角度公差
TrainingEmphasis:决定是否紧急判断快速计算或者高稳健性
AmbiguityCriterion:解决训练图像中初始组件的模糊匹配的标准
MaxContourOverlap:训练图像中发现的初始组件的最大轮廓
ClusterThreshold:阈值来聚类初始组件,两个组件属于同一刚性模型组件的概率
ComponentTrainingID:组件训练句柄
得到训练摸板组件get_training_components()
TrainingComponents:输出初始组件或模型组件的轮廓区域
ComponentTrainingID:训练结果的句柄
Components:返回的组件类型或初始组件的索引
Image:要返回组件的图像,‘model_image’
得到组件之间的关系get_component_relations()
Relations:输出区域关系
ComponentTraingID:输入训练结果句柄
ReferenceComponent:参考组件索引
Image:要返回组件关系的图像‘model_image’模型图片,‘1,2,3,样品图像
Row:
Colum:
Phi:
Length1:
Length2:
AngleStart:
AngleExtent:
改变一下组件之间的关系modify_component_relations()
注意:当训练期间使用的训练图像不覆盖相对运动的整个范围时,这个操作特别有用
ComponentTrainingID:训练句柄
ReferenceComponent:与运动相关的模型组件应该被修改(要修改哪些样品组件)
ToleranceComponent:修改其相对运动的模型组件(哪些样品组件修改公差)
PoaitionTolerance:以像素为单位的位置发生变化
AngleTolerance:弧度方向关系的变化
read_image(ModelImage,'dip_switch/dip_switch_model')
get_image_size(ModelImage,width,height)
dev_open_window(0,0,512,512,'black',window1)
dev_set_part(0,0,height,width)
dev_display(ModelImage)
gen_rectangle2 (InitialComponents, 265, 138, -0.02, 23, 13)
gen_rectangle2 (InitialComponent, 342, 286, -0.02, 168, 13)
concat_obj (InitialComponents, InitialComponent, InitialComponents)
for I := 0 to 11 by 1
gen_rectangle2 (InitialComponent, 311 + I * 0.5, 128 + I * 28.2, 0, 10, 12)
concat_obj (InitialComponents, InitialComponent, InitialComponents)
endfor
gen_empty_obj(trainImages)
for i:=1 to 12 by 1
read_image (TrainingImage, 'dip_switch/dip_switch_training_' + i$'02')
concat_obj(trainImages,TrainingImage,trainImages)
endfor
train_model_components(ModelImage,InitialComponents,trainImages,ModelComponents,45,45,30,0.95,-1,-1,rad(20),'speed','rigidity',0.2,0.5,ComponentID)
get_training_components(trainingComponents,ComponentID,'model_components', 'model_image', 'false', Row, Column, Angle, Score)
count_obj(trainingComponents,num)
for i:=1 to num by 1
get_component_relations(relations,ComponentID,i-1,'model_image',Row1, Column1, Phi, Length1, Length2, AngleStart, AngleExtent)
endfor
modify_component_relations(ComponentID,'all','all',0,rad(4))