read_image (Image, 'coins/20cent_italian.png')
gen_circle (ROI_0, 243.927, 353.516, 147.922)
reduce_domain (Image, ROI_0, ImageReduced)
create_shape_model (ImageReduced, 'auto', -0.39, 0.79, 'auto', ['point_reduction_high','no_pregeneration'], 'use_polarity', 30, 15, ModelID)
get_shape_model_contours (ModelContours, ModelID, 1)
count_seconds (S1)
find_shape_model (ImageReduced, ModelID, -0.39, 0.79, 0.5, 1, 0.5, 'least_squares', 0, 0.9, Row, Column, Angle, Score)
count_seconds (S2)
runtime:=(S2-S1)*1000
set_shape_model_param (ModelID, 'timeout', runtime)
*给图片增加……
get_image_size (ImageReduced, Width, Height)
*生成随机数
NumRect:=int(rand(1)*127)+1
gen_random_regions (Regions, 'rectangle2', 10, 20, 10, 30, -0.7854, 0.7854, NumRect, 512, 512)
Colors:=int(rand(NumRect)*255)
paint_region (Regions, Image, ImageResult, Colors, 'fill')
*结束
try
find_shape_model (ImageReduced, ModelID, Angle, Angle, 0.5, 1, 0.5, 'least_squares', 0, 0.9, Row1, Column1, Angle1, Score1)
catch (Exception)
disp_message (200000, Exception, 'window', 12, 12, 'black', 'true')
endtry
*不加try catch也行,能正常运行
clear_shape_model (ModelID)