Ask Your Question
1

GRID_ORB Detector on Android

asked 2013-04-12 07:53:36 -0500

xeed gravatar image

updated 2013-04-18 08:26:47 -0500

Hello there. I read that it's not possible to use GRID_ORB Detection with the code below. So how do you use it on android. I need to spread the features across the image. If you have another solution for this matter, you can give me that aswell.

FeatureDetector det = FeatureDetector.create(FeatureDetector.GRID_ORB);

A Code example would be really great.

Thanks in advance

EDIT1: Here some code for changing the Parameters of a extractor (works the same way for the detector). But how does it work together if I want to create a GRID_ORB Detector?

String filename = "/path/to/file/orb_params.yml";
writeFile(paramFile, "%YAML:1.0\nscaleFactor: 1.2\nnLevels: 8\nfirstLevel: 0 \nedgeThreshold: 31\npatchSize: 31\nWTA_K: 2\nscoreType: 0\nnFeatures: 500\n");

extractor.read(filename); //note: this will fail if the above parameters are not the ones expected by method

EDIT2: Here is a yml file from the ORB_GRID detector I created.

%YAML:1.0
name: "Feature2D.Grid"
detector:
name: "Feature2D.ORB"
WTA_K: 2
edgeThreshold: 31
firstLevel: 0
nFeatures: 500
nLevels: 8
patchSize: 31
scaleFactor: 1.2000000476837158e+00
scoreType: 0
gridCols: 4
gridRows: 4
maxTotalKeypoints: 1000

So it seems to be a GRID Detector, but if i detect the keypoints of an image, there aren't any.

EDIT3: FeatureDetector det = FeatureDetector.create(FeatureDetector.GRID_FAST); GRID_FAST works pretty good, but the ORB descriptors of these features are bad. I have no clue why GRID_ORB doesn't give any keypoints. I adjusted the parameters so they suit the grid detection better.

%YAML:1.0
name: "Feature2D.Grid"
detector:
name: "Feature2D.ORB"
WTA_K: 2
edgeThreshold: 31
firstLevel: 0
nFeatures: 10
nLevels: 8
patchSize: 31
scaleFactor: 1.2000000476837158e+00
scoreType: 0
gridCols: 8
gridRows: 8
maxTotalKeypoints: 500
edit retag flag offensive close merge delete

Comments

I hope i won't end up splitting the image myself...

xeed gravatar imagexeed ( 2013-04-18 09:42:37 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-04-22 10:24:28 -0500

xeed gravatar image

updated 2013-04-22 10:27:38 -0500

Of course there is always a simple solution. The parameters, which you can't easily access in Java are bad for my kind of situation. My input image is pretty small (320x240). So if I split into 4x4 tiles, I have a size of 80x60. The default detector has a edgethreshold of 31 which leaves 0 pixels to detect features on. It's pretty dumb. ^^ Here is the fixed code, so guyy having the same problem can adopt it. I reduced the edgeThreshold to 3.

FeatureDetector det = FeatureDetector.create(FeatureDetector.ORB);
String filename = "/mnt/sdcard/orb_params.yml";
writeFile(filename, "%YAML:1.0\nname: \"Feature2D.Grid\"\ndetector: \n   name: \"Feature2D.ORB\"\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: 500\n");
det.read(filename);

You should really look into the spaces and newlines(\n). There need to be three spaces in front of every "key: value" after the detector: \n. This is the indentation of the Submap. Look into YAML specification to learn more about it.

Here the YAML File in better shape:

%YAML:1.0
name: "Feature2D.Grid"
detector:
name: "Feature2D.ORB"
WTA_K: 2
edgeThreshold: 3
firstLevel: 0
nFeatures: 60
nLevels: 8
patchSize: 31
scaleFactor: 1.2000000476837158e+00
scoreType: 0
gridCols: 4
gridRows: 4
maxTotalKeypoints: 500
edit flag offensive delete link more

Comments

Can anybody accept this answer? I can't...

xeed gravatar imagexeed ( 2013-04-22 10:26:54 -0500 )edit

I only can in 2 days time :) will keep in mind to do so

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-22 11:40:47 -0500 )edit
0

answered 2013-04-12 08:57:12 -0500

This code uses the GRID_ORB option. It shows clearly how the Java API is built up. Maybe try creating a project based on this information?

http://code.google.com/p/aulas-unijui/source/browse/trunk/7+Sem/robotica/Carrinho/src/org/opencv/features2d/FeatureDetector.java?r=244

We do not deliver hand made code on this forum, rather we encourage people to try stuff out and then ask for feedback on their problems.

edit flag offensive delete link more

Comments

Well, thanks for the answer, but this source leads me to the exact same line. It's not that I didn't try. I tried and it didn't work. So here I am asking you for advice. I read that you kinda need to write a .yml file with the preferences of the detector. And read it in. But I have no clue how to adapt this for a this kind of "cross detector". I hope you know what I mean.

xeed gravatar imagexeed ( 2013-04-18 05:54:38 -0500 )edit

In addition. In the source (and in the doc aswell) is written, that you can use ORB,SIFT,etc. and combinations of Grid, Pyramid, etc. + ORB, SIFT, etc. in the Form of "GridORB". Since the function takes an Integer I expected that a pass of "FeatureDetector.GRID_ORB" would work, but it doesn't ...

xeed gravatar imagexeed ( 2013-04-18 06:04:13 -0500 )edit

Could you maybe use Dense-keypoints and ORB features instead of Grid+ORB keypoints + ORB features?

Guanta gravatar imageGuanta ( 2013-04-18 06:20:53 -0500 )edit

Just tried Dense. Its giving definetly too many false positives. I need a detector optimized for the following matching algorithm. I tried several detectors before, but they dont work with the ORB Matching. ORB Matching is not a fixed choice, but i figured that its a good choice according to performance and robustness against rotation and scaling.

xeed gravatar imagexeed ( 2013-04-18 06:38:20 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-04-12 07:53:36 -0500

Seen: 1,115 times

Last updated: Apr 22 '13