Java opencv中sift的实现

Java 使用opencv中的sift进行计算。

<span style="white-space:pre">	</span>/**
	 * 传入一张图片得到sift特征点
	 * @param mat
	 * @return
	 */
	public MatOfKeyPoint getFeaturePoints(Mat mat){
		FeatureDetector fd = FeatureDetector.create(FeatureDetector.SIFT);
		MatOfKeyPoint mkp =new MatOfKeyPoint();
		fd.detect(mat, mkp);
		return mkp;
	}
	
	/**
	 * 获取sift特征
	 * @param mat
	 * @return
	 */
	public Mat getFeature(Mat mat){
		Mat desc = new Mat();
		MatOfKeyPoint mkp = getFeaturePoints(mat);
		DescriptorExtractor de = DescriptorExtractor.create(DescriptorExtractor.SIFT);
	    de.compute(mat,mkp,desc );//提取sift特征
	    return desc;
	}

原创地址:http://blog.csdn.net/yuexin2/article/details/46894023

版权声明:本文为博主原创文章,未经博主允许不得转载。

文章来自:http://blog.csdn.net/yuexin2/article/details/46894023
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3