图片:
代码:
read_image (Image, 'C:/Users/14348/Desktop/mobanpipei.jpg')
get_image_size (Image, Width, Height)
dev_close_window()
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_display (Image)
draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2)
gen_rectangle1 (Rectangle, Row1, Column1, Row2, Column2)
reduce_domain (Image, Rectangle, ImageReduced)
crop_domain (ImageReduced, ImageA)
*创建匹配模板
*Model_ID 最终匹配的模板文件
create_shape_model (ImageA, 'auto', rad(0), rad(90), 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID)
dev_display(Image)
find_shape_model (Image, ModelID, rad(0), rad(90), 0.5, 0, 0.5, 'least_squares', 0, 0.9, Row, Column, Angle, Score)
tuple_length (Score, Length)
for Index := 0 to Length-1 by 1
disp_cross (WindowHandle, Row, Column, 20, 0)
disp_message (WindowHandle, 'Score'+Score[Index], 'window', Row[Index], Column[Index]+100, 'black', 'true')
endfor
结果: