Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Android: How to change GRID_ORB parameters?

Hi, I can change ORB parameters but I can't change GRID_ORB parameters. I'm using GRID_ORB for feature detector in Android Studio. I'm trying to change the parameters based on this. When I change nFeatures to 60 and maxTotalKeypoints to 60 too, it still give me 500 keypoints (default). This is my code that isn't working:

File outputDir = getCacheDir();
File outputFile = null;
try {
    outputFile = File.createTempFile("orbDetectorParams", ".YAML", outputDir);
    writeToFile(outputFile, "%YAML:1.0\n   WTA_K: 2\n   edgeThreshold: 3\n   firstLevel: 0\n   nFeatures: 60\n   nLevels: 8\n   patchSize: 31\n   scaleFactor: 1.2000000476837158e+00\n   scoreType: 0\n   gridCols: 4\n   gridRows: 4\n   maxTotalKeypoints: 60\n");
} catch (IOException e) {
    e.printStackTrace();
}
detector.read(outputFile.getPath());

This is how I change ORB parameters:

writeToFile(outputFile, "%YAML:1.0\nscaleFactor: 1.2\nnLevels: 8\nfirstLevel: 0 \nedgeThreshold: 31\npatchSize: 31\nWTA_K: 2\nscoreType: 1\nnFeatures: 60\n");

I've tried almost everything but it's still not working. Can you help me?