使用nodeitk进行特征识别

前言

今天,东莞,天气晴。温度33到27度。今天天气晴。这段时间期末,事情比较多,也很久没有更新博客。前几周终于把特征识别完成,由于最近把国外的一些网站给屏蔽了,因此暂时只能重启csdn写文章。


本文对特征识别的用法简单描述。本文你将学会使用nodeitk,


- 使用DescriptorExtractor接口查找关键点对应的特征向量
- 使用BFMatcher匹配特征向量
- 使用drawMatches绘制特征匹配


源代码

    var node_itk = require('./node-itk');
    // 读取模块图
    var img_1 = node_itk.cv.imread( "./images/lena.jpg", node_itk.cv.CV_LOAD_IMAGE_GRAYSCALE );
    // 读取目标图
    var img_2 = node_itk.cv.imread( "./images/lena.jpg", node_itk.cv.CV_LOAD_IMAGE_GRAYSCALE );
    minHessian = 400
    // 设置特征检测方法
    detector = new node_itk.cv.NodeOpenCVFeatureDetector("SURF")
    detector.Set("hessianThreshold", minHessian)
    keypoints_1 = detector.Detect( img_1 );
    keypoints_2 = detector.Detect( img_2 );
    // 获取特征描述
    extractor = new node_itk.cv.NodeOpenCVDescriptorExtractor("SURF");
    descriptors_1 = extractor.Compute(img_1, keypoints_1)
    descriptors_2 = extractor.Compute(img_2, keypoints_2)
    // 设置匹配方法
    matcher = new node_itk.cv.NodeOpenCVDescriptorMatcher("FlannBased");
    matches = matcher.Match(descriptors_1, descriptors_2);
    // 绘制匹配结果
    img_matches = node_itk.cv.DrawMatches(img_1, keypoints_1, img_2, keypoints_2, matches);
    node_itk.cv.NamedWindow( "match", node_itk.cv.CV_WINDOW_AUTOSIZE );
    node_itk.cv.imshow( "match", img_matches );
    c = node_itk.cv.WaitKey ( 0 );
    if( c >= 0 ) { return -1; }

结果

小结


nodeitk是由本人独立开发的基于nodejs图像处理工具。它包含基本的图像处理、视频处理还包含其它特征匹配功能。有关它的早前介绍请参见链接。待续。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值