设置首页收藏本站在线聊天
授权版本:2024_09
开启左侧

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

[复制链接]
1451052616 发表于 2022-4-22 12:55:54 | 显示全部楼层 |阅读模式
  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
复制代码


奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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