我在计算 SIFT 检测器找到的关键点的 ORB 描述符时遇到了很大的问题。如果我尝试运行一个简单的示例程序,整个系统就会冻结,我不知道为什么。示例代码如下:
import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImageM;
import com.googlecode.javacv.cpp.opencv_core.CvMat;
import com.googlecode.javacv.cpp.opencv_features2d.DescriptorExtractor;
import com.googlecode.javacv.cpp.opencv_features2d.FeatureDetector;
import com.googlecode.javacv.cpp.opencv_features2d.KeyPoint;
import com.googlecode.javacv.cpp.opencv_features2d.ORB;
import com.googlecode.javacv.cpp.opencv_nonfree.SIFT;
public class DescriptorTest {
public static void main(String[] args) {
SIFT sift = new SIFT(0, 3, 0.04, 10, 1.6);
FeatureDetector detector = sift.getFeatureDetector();
ORB orb_descriptor = new ORB(500, 1.2f, 8, 31, 0, 2, 0, 31);
DescriptorExtractor descriptor = orb_descriptor.getDescriptorExtractor();
CvMat image = cvLoadImageM("res/dvd_009_ref.jpg");
KeyPoint keypoints = new KeyPoint();
CvMat descriptors = new CvMat(null);
detector.detect(image, keypoints, null);
System.out.println("Keypoints found: "+ keypoints.capacity());
descriptor.compute(image, keypoints, descriptors);
System.out.println("Descriptors calculated: "+descriptors.rows());
}
}
有谁知道问题是什么?会很好 :)