Sift android,SURF& SIFT功能检测器OpenCV android

我想检测图像关键点。我使用OpenCV库中的不同特征检测器尝试了以下代码。

适用于ORB,BRISK,FAST等

但不适用于SURF / SIFT甚至MSER探测器!

public class ReadImaageActivity extends ActionBarActivity {

Mat image ; File fileimage ;

TimePicker time ;

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {

@Override

public void onManagerConnected(int status) {

switch (status) {

case LoaderCallbackInterface.SUCCESS:

{

Log.i("activity", "OpenCV loaded successfully");

fileimage = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/7.jpg");

if (fileimage.exists())

image = Highgui.imread(fileimage.getAbsolutePath() ,Highgui.CV_LOAD_IMAGE_COLOR);

else Log.i("activity","dont exit") ;

//

long startTime = System.nanoTime();

FeatureDetector fd= FeatureDetector.create(FeatureDetector.SURF);

MatOfKeyPoint keypoints= new MatOfKeyPoint();

try

{

fd.detect(image, keypoints);

} catch (Exception e) {

e.printStackTrace();

}

long endTime = System.nanoTime();

long duration = (endTime - startTime)/1000000; //divide by 1000000 to get milliseconds.

if (!keypoints.empty())

{

Log.i("Keypoints", "is not empty");

System.out.println("duration"+""+duration);

System.out.println("size"+""+keypoints.size());

}

else

Log.i("Keypoints", "is not empty");

/*

Mat descriptors=new Mat();

DescriptorExtractor dex =DescriptorExtractor.create(DescriptorExtractor.SURF);

{

dex.compute(image, keypoints, descriptors);

long endTime = System.nanoTime();

long duration = (endTime - startTime)/1000000; //divide by 1000000 to get milliseconds.

System.out.println(descriptors.size());

System.out.println("duration"+duration);

}

else System.out.println("a3");

*/

} break;

default:

{

super.onManagerConnected(status);

} break;

}

}

};

@SuppressLint("NewApi") @Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_read_imaage);

}

@Override

public void onResume()

{

super.onResume();

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_9, this, mLoaderCallback);

}

}

这是因为不支持SURF和SIFT算法?

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值