Search code examples
javaopencvcomputer-visionjavacv

BRISK in javaCV - How to initialize the descriptor matrix?


I am trying to run BRISK within java using the openCV wrapper javacv. I don't have any problems running a FAST corner detector but I am stuck on how to run the compute function. When I run this code:

private int threshold = 30;
private int octaves = 3;
private float scale = 1.0f;

private BRISK brisk = null;
private KeyPoint keyPoints = null;
private CvMat img, descriptors;

descriptors = new CvMat();
keyPoints = new KeyPoint();

img = getFrame();

brisk = new BRISK(threshold, octaves, scale);
brisk.compute(img, null, keyPoints, descriptors, false);

I get following error:

OpenCV Error: Bad argument (Unknown array type) in unknown function, file ......\src\opencv\modules\core\src\matrix.cpp, line 698

I am sure that the img is not the problem because I can run a FAST corner detection on it. I think the actual problem is the descriptors matrix because I have no clue how to initialize it. Any ideas?


Solution

  • The solution to the problem is the descriptors need to be initialized as new CvMat(null)