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

Hello Mat

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 34|回复: 0

基于SVM的图像分割

[复制链接]

645

主题

760

帖子

4121

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4121
发表于 7 天前 | 显示全部楼层 |阅读模式
基于SVM的图像分割:参考链接: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
群智能算法视频售价:38元,链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

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

本版积分规则


Python|Opencv|MATLAB|Halcom.cn  

GMT+8, 2018-12-11 18:54 , Processed in 0.139919 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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