请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册
查看: 8485|回复: 2

基于SVM的图像分割

[复制链接]

1294

主题

1520

帖子

110

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22633
发表于 2018-12-4 23:18:18 | 显示全部楼层 |阅读模式
基于SVM的图像分割:
链接:https://pan.baidu.com/s/1xdnckcLcV0jhfsuEbL2Gfg 提取码:qixt
参考链接:https://pan.baidu.com/s/1XQmrm-26SCSnPOZPHplqAQ
  1. dev_update_window ('off')
  2. dev_set_draw ('margin')
  3. dev_update_var ('off')
  4. dev_update_pc ('off')
  5. read_image (Image, './plastic_mesh/plastic_mesh_01.png')
  6. get_image_size (Image, Width, Height)

  7. gen_rectangle1 (Rectangle, 10, 10, Height / 2 - 11, Width / 2 - 11)
  8. * Create the SVM classifier with the novelty detection mode.
  9. create_class_svm (5, 'rbf', 0.01, 0.0005, 1, 'novelty-detection', 'normalization', 5, SVMHandle)
  10. for J := 1 to 5 by 1
  11.     read_image (Image, './plastic_mesh/plastic_mesh_0' + J +'.png')
  12.     zoom_image_factor (Image, ImageZoomed, 0.5, 0.5, 'constant')
  13.     gen_texture_image (ImageZoomed, ImageTexture)
  14.     * 增加训练样本
  15.     add_samples_image_class_svm (ImageTexture, Rectangle, SVMHandle)
  16. endfor
  17. dev_display (ImageZoomed)
  18. * 训练
  19. train_class_svm (SVMHandle, 0.001, 'default')
  20. * 降维
  21. reduce_class_svm (SVMHandle, 'bottom_up', 2, 0.001, SVMHandleReduced)
  22. * Now detect errors in the plastic meshes.
  23. for J := 1 to 14 by 1
  24.     read_image (Image, './plastic_mesh/plastic_mesh_0' + J +'.png')
  25.     zoom_image_factor (Image, ImageZoomed, 0.5, 0.5, 'constant')
  26.     gen_texture_image (ImageZoomed, ImageTexture)
  27.     reduce_domain (ImageTexture, Rectangle, ImageTextureReduced)
  28.     * SVM分类器
  29.     classify_image_class_svm (ImageTextureReduced, Errors, SVMHandleReduced)
  30.     * 形态学处理
  31.     opening_circle (Errors, ErrorsOpening, 3.5)
  32.     closing_circle (ErrorsOpening, ErrorsClosing, 10.5)
  33.     connection (ErrorsClosing, ErrorsConnected)
  34.     select_shape (ErrorsConnected, FinalErrors, 'area', 'and', 300, 1000000)
  35.     count_obj (FinalErrors, NumErrors)
  36.     dev_set_color ('red')
  37.     dev_set_line_width (3)
  38.     dev_display (FinalErrors)
  39.     stop ()
  40. endfor
  41. clear_class_svm (SVMHandle)
  42. clear_class_svm (SVMHandleReduced)
复制代码







本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

0

主题

8

帖子

1

金钱

新手上路

Rank: 1

积分
9
发表于 2020-5-7 20:41:16 | 显示全部楼层
感谢分享!!~~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-4-19 03:12 , Processed in 0.257501 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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