SIFT - Insufficient memory [closed]
Hello,
I have to detect keypoints on big sized images (about 6mb). I have tried SURF and it works fine and now I'm trying to use SIFT. The code is simple:
cv::Mat image = imread("../images/IMG_3849.jpg", CV_LOAD_IMAGE_GRAYSCALE);
cv::SiftFeatureDetector detector;
std::vector<cv::KeyPoint> keypoints;
detector.detect(image, keypoints);
cv::SiftDescriptorExtractor extractor;
cv::Mat descriptors_object;
extractor.compute( image, keypoints, descriptors_object );
However when I run this code, I get the error "OpenCV Error: Insufficient memory - Failed to allocate 286654468 bytes".
Anyone knows why this might be happening?
Thank you!
How large is your RAM and how large the image? Since SIFT is 128 dimensional in contrast to SURF which is 64 dimensional it could just be that you really ran out of memory. If this happens at the detection step you might process the image in parts, or if this happens at the compute step (which is more probable) then you can just process parts of the keypoints.
I have 8 Gb RAM and the image is 5184x3456. The error happens at the detection step, I believe. Particularly in this line:
detector.detect(image, keypoints);
I'm probably running out of memory since the code works fine with smaller images. Thank you for your answer Guanta.