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

滤波核选择测试,记录一下

[复制链接]
freekun139com 发表于 2023-5-5 17:00:26 | 显示全部楼层 |阅读模式
  1. *测试目标图形: 小图形约20x20, 大图形约40x40
  2. read_image (Image, '滤波核测试.png')
  3. rgb1_to_gray (Image, GrayImage)

  4. *默认滤波核小于目标, 筛选到目标有孔洞, 结构不完整
  5. mean_image (GrayImage, ImageMean, 9, 9)     //*滤波后目标灰度113 - 176
  6. dyn_threshold (GrayImage, ImageMean, RegionDynThresh, 5, 'dark')
  7. connection (RegionDynThresh, ConnectedRegions)
  8. region_features (ConnectedRegions, 'width', Value)

  9. *滤波核未超过目标宽度, 小图形筛选正常, 小矩形有孔洞, 结构不完整
  10. mean_image (GrayImage, ImageMean0, 19, 19)  //*滤波后目标灰度121 - 184
  11. dyn_threshold (GrayImage, ImageMean0, RegionDynThresh0, 5, 'dark')
  12. connection (RegionDynThresh0, ConnectedRegions0)
  13. region_features (ConnectedRegions0, 'width', Value0)

  14. *小图形筛选正常, 大图形筛选有孔洞, 结构不完整
  15. mean_image (GrayImage, ImageMean1, 21, 21)  //*滤波后目标灰度121 - 185
  16. dyn_threshold (GrayImage, ImageMean1, RegionDynThresh1, 5, 'dark')
  17. connection (RegionDynThresh1, ConnectedRegions1)
  18. region_features (ConnectedRegions1, 'width', Value1)

  19. *小图形筛选正常, 大矩形筛选有孔洞, 结构不完整
  20. mean_image (GrayImage, ImageMean2, 39, 39)  //*滤波后目标灰度166 - 187
  21. dyn_threshold (GrayImage, ImageMean2, RegionDynThresh2, 5, 'dark')
  22. connection (RegionDynThresh2, ConnectedRegions2)
  23. region_features (ConnectedRegions2, 'width', Value2)

  24. *小图形筛选正常, 大图形筛选正常: 最大目标宽度
  25. mean_image (GrayImage, ImageMean3, 41, 41)  //*滤波后目标灰度188 - 191
  26. dyn_threshold (GrayImage, ImageMean3, RegionDynThresh3, 5, 'dark')
  27. connection (RegionDynThresh3, ConnectedRegions3)
  28. region_features (ConnectedRegions3, 'width', Value3)

  29. *小图形筛选正常, 大图形筛选正常: 2倍最大目标宽度
  30. mean_image (GrayImage, ImageMean4, 81, 81)  //*滤波后目标灰度222 - 237, 图形内基本一致
  31. dyn_threshold (GrayImage, ImageMean4, RegionDynThresh4, 5, 'dark')
  32. connection (RegionDynThresh4, ConnectedRegions4)
  33. region_features (ConnectedRegions4, 'width', Value4)

  34. *小图形筛选正常, 大图形筛选正常:
  35. mean_image (GrayImage, ImageMean5, 301, 301)  //*滤波后目标灰度240, 图形内基本一致
  36. dyn_threshold (GrayImage, ImageMean5, RegionDynThresh5, 5, 'dark')
  37. connection (RegionDynThresh5, ConnectedRegions5)
  38. region_features (ConnectedRegions5, 'width', Value5)


  39. *所以滤波核选择时应该参照最大待筛选目标, 不能小于目标宽度, 考虑效率可使用(2x目标宽度+1)
复制代码

滤波核测试.png
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
梅启升 发表于 2023-8-29 17:57:35 | 显示全部楼层
滤波核越大,处理出来的效果越明显,学到了
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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