设为首页收藏本站
授权版本:2024_07
开启左侧

关于做该齿轮的表面质量检测探讨

[复制链接]
1451052616 发表于 2022-4-22 12:49:18 | 显示全部楼层 |阅读模式
  1. dev_update_off ()
  2. dev_clear_window ()

  3. for Index := 1 to 2 by 1
  4.     read_image (Image, 'C:/Users/TIAN/Desktop/bb053aa1b6baf861c111a40a47a3c8ba.jpeg')
  5.     get_image_size (Image, Width, Height)
  6.     dev_open_window (0, 0, Width , Height, 'blue', WindowHandle)
  7.     set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
  8.     dev_display (Image)
  9.     threshold (Image, Regions, 147, 255)
  10.     connection (Regions, ConnectedRegions)
  11.     select_shape (ConnectedRegions, CircularRegions, \
  12.                   ['area', 'circularity'], 'or', \
  13.                   [20000, 0.6], [9999999, 1.0])
  14.     reduce_domain (Image, CircularRegions, ImageReduced)
  15.     derivate_gauss (ImageReduced, DerivGauss, 1.5, 'gradient')
  16.     threshold (DerivGauss, GaussRegion, 9, 50)
  17.     connection (GaussRegion, ConnectedGaussRegions)
  18.     select_shape_std (ConnectedGaussRegions, EdgeSelectedStd, 'max_area', 70)
  19.     fill_up (EdgeSelectedStd, RegionFillUp)
  20.     difference (RegionFillUp, EdgeSelectedStd, RegionFillUp)
  21.     connection (RegionFillUp, DiffRegions)
  22.     select_shape (DiffRegions, DefectRegions, 'area', 'and', 50, 2000)
  23.     dev_display (Image)
  24. *     dev_set_draw ('margin')
  25.     dev_display (DefectRegions)
  26.     if (Index < 2)
  27.         disp_continue_message (WindowHandle, 'black', 'true')
  28.         stop ()
  29.     endif
复制代码

程序到difference这一步就卡住 有大佬帮忙看看吗
bb053aa1b6baf861c111a40a47a3c8ba.jpg
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
daihui 发表于 2022-4-22 16:00:16 | 显示全部楼层
    read_image (Image, 'E:/Picture/待图2/124844oetyye0ye029kek2.jpg')
    get_image_size (Image, Width, Height)

    dev_open_window (0, 0, Width , Height, 'black', WindowHandle)
    set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
    dev_display (Image)
    threshold (Image, Regions, 147, 255)
    connection (Regions, ConnectedRegions)
    select_shape_std (ConnectedRegions, SelectedRegions, 'max_area', 70)
    fill_up (SelectedRegions, RegionFillUp)
   
    difference (RegionFillUp, SelectedRegions, RegionDifference)
    closing_circle (RegionDifference, RegionClosing, 50)
    difference (RegionFillUp, RegionClosing, RegionDifference1)
    gen_contour_region_xld (RegionDifference1, Contours, 'border_holes')
    dev_display (Image)
    dev_display (Contours)
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表