SIFT - Insufficient memory [closed]

asked 2014-12-29 09:04:35 -0600

andré gravatar image

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!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-09-26 13:49:08.110175

Comments

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.

Guanta gravatar imageGuanta ( 2014-12-29 10:06:19 -0600 )edit

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.

andré gravatar imageandré ( 2014-12-29 10:30:21 -0600 )edit