NullpointerException when using a descriptor
I am currently trying to compare 2 images with OpenCV. One image is on the SD card, the other image is made when pressing a button, and that picture will then be compared to the one on the SD card. I am using FAST detection (which works fine, i get back a lot of keypoints), and then I want to use a FREAK descriptor, but this is where it all goes wrong.
MatOfKeyPoint points1 = new MatOfKeyPoint();
private FeatureDetector detector;
private DescriptorExtractor descriptor;
psuedo code for the fast detection, which works
fast1.detect(mIntermediateMat,points1);
// descriptor
descriptor2 = DescriptorExtractor.create(DescriptorExtractor.FREAK);
descriptor2.compute(mIntermediateMat, points1, descriptors);
I get the next error in the compute part of the descriptor line:
04-23 11:58:03.840: E/AndroidRuntime(18729): FATAL EXCEPTION: main 04-23 11:58:03.840: E/AndroidRuntime(18729): java.lang.NullPointerException 04-23 11:58:03.840: E/AndroidRuntime(18729): at org.opencv.features2d.DescriptorExtractor.compute(DescriptorExtractor.java:106) 04-23 11:58:03.840: E/AndroidRuntime(18729): at be.artesis.findmymovie.camera$2.onClick(camera.java:267)
When running the debug mode it looks like the descriptors field in descriptor2.compute is null. Am I wrong when thinking that is has to be null untill computed, since we use the FREAK algorithm to find the descriptors?
I have no idea what is wrong at the moment, does anyone know what needs to be done? Did I do some bad initialization?