halcon的一些程序问题,后面加上endif,if后面的就不执行了,不加到话,到了vector那里就出现程序错误
dev_set_draw('margin')read_image(Image,'D:/halcon机器视觉/案例分析/焊锡图片/161006170547039.bmp')...
dev_set_draw ('margin')
read_image(Image, 'D:/halcon机器视觉/案例分析/焊锡图片/161006170547039.bmp')
gen_rectangle1 (Rectangle1, 547,747,847,2059)
gen_rectangle1 (Rectangle2,1440,757,1698,2101)
union2 (Rectangle1, Rectangle2, RegionUnion)
gen_circle (Circle, 1142,842,225)
gen_circle (Circle1,1133,2003,220)
union2 (Circle, Circle1, RegionUnion1)
reduce_domain (Image, RegionUnion1, ImageReduced)
create_shape_model (ImageReduced, 'auto', 0, 0, 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID)
get_shape_model_contours (ModelContours, ModelID, 1)
* Code generated by Image Acquisition 01
list_files ('D:/halcon机器视觉/案例分析/焊锡图片', ['files','follow_links'], ImageFiles)
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima)$','ignore_case'], ImageFiles)
for Index := 0 to |ImageFiles| - 1 by 1
read_image (Image, ImageFiles[Index])
find_shape_model (Image, ModelID, 0, 0, 0.5, 1, 0.5, 'least_squares', 0, 0.9,Column, Row, Angle, Score)
if(|Score|>0)
dev_display_shape_matching_results (ModelID, 'red', Column,Row, Angle, 1, 1, 0)
area_center (RegionUnion, Area, Row1, Column1)
vector_angle_to_rigid (Column,Row, 0, Row1, Column1, Angle, HomMat2D)
affine_trans_image (Image, ImageAffinTrans, HomMat2D, 'constant', 'false')
* Do something
endif
stop ( )
endfor 展开
read_image(Image, 'D:/halcon机器视觉/案例分析/焊锡图片/161006170547039.bmp')
gen_rectangle1 (Rectangle1, 547,747,847,2059)
gen_rectangle1 (Rectangle2,1440,757,1698,2101)
union2 (Rectangle1, Rectangle2, RegionUnion)
gen_circle (Circle, 1142,842,225)
gen_circle (Circle1,1133,2003,220)
union2 (Circle, Circle1, RegionUnion1)
reduce_domain (Image, RegionUnion1, ImageReduced)
create_shape_model (ImageReduced, 'auto', 0, 0, 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID)
get_shape_model_contours (ModelContours, ModelID, 1)
* Code generated by Image Acquisition 01
list_files ('D:/halcon机器视觉/案例分析/焊锡图片', ['files','follow_links'], ImageFiles)
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima)$','ignore_case'], ImageFiles)
for Index := 0 to |ImageFiles| - 1 by 1
read_image (Image, ImageFiles[Index])
find_shape_model (Image, ModelID, 0, 0, 0.5, 1, 0.5, 'least_squares', 0, 0.9,Column, Row, Angle, Score)
if(|Score|>0)
dev_display_shape_matching_results (ModelID, 'red', Column,Row, Angle, 1, 1, 0)
area_center (RegionUnion, Area, Row1, Column1)
vector_angle_to_rigid (Column,Row, 0, Row1, Column1, Angle, HomMat2D)
affine_trans_image (Image, ImageAffinTrans, HomMat2D, 'constant', 'false')
* Do something
endif
stop ( )
endfor 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询