标签:尺寸 sha win 模板 mat size 中心 image reduce
dev_set_draw (‘margin‘)
read_image (Image, ‘D:/Project/PC_视觉类/视库/样图/A正.jpg‘)
get_image_size (Image, Width, Height)
dev_get_window (WindowHandle)
*以下为创建mark(即ImageReduced)时用,且写到文件中
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2)
gen_rectangle1 (Rectangle, Row1, Column1, Row2, Column2)
area_center (Rectangle, Area, RowRef, ColumnRef)
reduce_domain (Image, Rectangle, ImageReduced)
crop_domain (ImageReduced, ImagePart)
write_image (ImagePart, ‘bmp‘, 0, ‘D:/Project/PC_视觉类/视库/样图/mark.bmp‘)
*以下为直接读取mark文件
read_image (Image2, ‘D:/Project/PC_视觉类/视库/样图/mark.bmp‘)
*求出mark的外框尺寸以及中心点
* binary_threshold (Image2, Region, ‘max_separability‘, ‘dark‘, UsedThreshold)
* area_center (Region, Area, RowRef, ColumnRef)
* get_image_size (Image2, Width1, Height1)
* gen_rectangle1 (Rectangle, 0, 0, Height1-1, Width1-1)
*建立查找模型
create_shape_model (Image2, ‘auto‘, rad(0), rad(365), ‘auto‘, ‘auto‘, ‘use_polarity‘, ‘auto‘, ‘auto‘, ModelID)
*打开文件并查找
read_image (Image1, ‘D:/Project/PC_视觉类/视库/样图/A歪.jpg‘)
find_shape_model (Image1, ModelID, -0.39, 0.79, 0.5, 1, 0.5, ‘least_squares‘, 0, 0.9, Row, Column, Angle, Score)
*仿射,图片翻转
vector_angle_to_rigid ( Row, Column, Angle,RowRef, ColumnRef,0 ,HomMat2D1)
affine_trans_image (Image1, ImageAffineTrans, HomMat2D1, ‘constant‘, ‘false‘)
*清除模型
clear_shape_model (ModelID)
标签:尺寸 sha win 模板 mat size 中心 image reduce
原文地址:https://www.cnblogs.com/dingyd/p/12992739.html