• 圆的拟合__测量圆心距


    read_image(Image, 'gj1')
    emphasize (Image, ImageEmphasize, 7, 7, 1)
    
    rgb1_to_gray (ImageEmphasize, GrayImage)
    threshold (GrayImage, Regions, 62, 255)
    **填充孔洞
    fill_up (Regions, RegionFillUp)
    **断开并选择
    connection (RegionFillUp, ConnectedRegions)
    select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 141786, 159011)
    **扩展边缘到工件外周那圈黑的
    dilation_circle (SelectedRegions, RegionDilation, 5)
    **填写边缘
    shape_trans (RegionDilation, RegionTrans, 'convex')
    
    **由区域获取外边缘轮廓
    gen_contour_region_xld (RegionTrans, Contours, 'border')
    **拟合外边缘轮廓
    fit_circle_contour_xld (Contours, 'algebraic', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder)
    **由拟合参数生成一个拟合后的轮廓 
    gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, rad(360), 'positive', 1)
    stop()
    *********处理内圆*****************
    threshold (GrayImage, Regions1, 12, 36)
    fill_up (Regions1, RegionFillUp1)
    connection (RegionFillUp1, ConnectedRegions1)
    select_shape (ConnectedRegions1, SelectedRegions1, ['area','circularity'], 'and', [18599,0.6916], [26972.6,0.9074])
    shape_trans (SelectedRegions1, RegionTrans1, 'outer_circle')
    gen_contour_region_xld (RegionTrans1, Contours1, 'border')
    fit_circle_contour_xld (Contours1, 'algebraic', -1, 0, 0, 3, 2, Row1, Column1, Radius1, StartPhi1, EndPhi1, PointOrder1)
    gen_circle_contour_xld (ContCircle1, Row1, Column1, Radius1, 0, 6.28318, 'positive', 1)
    
    
    dev_clear_window ()
    dev_display (ContCircle1)
    dev_display (ContCircle)
    disp_cross (200000, Row1, Column1, 6, 0)
    disp_cross (200000, Row, Column, 6, 0)
    **计算圆心距离
    distance_pp (Row, Column, Row1, Column1, Distance)
    disp_message (200000, Distance, 'window', 20, 20, 'black', 'true')
    View Code

  • 相关阅读:
    MOCK服务小结
    微信收款「商业版」与「个人版」有什么区别?看完这篇你就懂!
    LB 负载均衡的层次结构
    中兴应用之星携手天翼开放平台:让APP开发更简单
    常见面试题之二叉树
    【深入JAVA EE】Spring配置文件解析
    spring-struts-mybatis整合错误集锦
    Redis安装
    Atitit.ati dwr的原理and设计 attilax 总结 java php 版本号
    Android UI开发神兵利器之Icon
  • 原文地址:https://www.cnblogs.com/wdfrog/p/15131226.html
Copyright © 2020-2023  润新知