Setting SURF algorithm parameters in OpenCV Android or Java

牧云@^-^@ 提交于 2019-12-01 11:01:26

问题


A question about the object matching in Android-Opencv.

As I cannot find any sample code of using SURF in Android platform. I would like to refer to some sample codes in C++.

But I have no idea about how to set the threshold value of SURF FeatureDetector in Android. Anyone with experience of Android-Opencv can help ?

Thanks a lot..!


回答1:


I don't think is possible right now, but there is a workaround I'm using. You have to create a text file containig the parameters and then read the file with the method inside your feature detector. Something like this:

File tempDir = context.getCacheDir();
File tempFile = File.createTempFile("config", ".yml", tempDir);

String settings = "%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n";

FileWriter writer = new FileWriter(tempFile, false);
writer.write(settings);
writer.close();

SURFDetector.read(tempFile.getPath());

Hope this will help you!



来源:https://stackoverflow.com/questions/7410852/setting-surf-algorithm-parameters-in-opencv-android-or-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!