insufficient memory using SIFT

asked 2018-01-25 11:08:09 -0600

I want to use OpenCV Python to do SIFT feature detection on remote sensing images. These images are high resolution and can be thousands of pixels wide (7000 x 6000 or ~160 MB). I am having trouble with insufficient memory, however. I've ran the same image through SIFT in Matlab (using VLFEAT) without problems. Looking at the documentation, I see that the returned descriptor is (num_keypoints x 128) array, which is probably what is causing the memory issues. VLFEAT returns only (x,y,scale,orient), however, which is easier to store in memory. Is there a way to use OpenCV so that histogram information is not saved along the way? Or is there some other issue going on that I'm not seeing?

img = cv2.imread('home.jpg')
sift = cv2.xfeatures2d.SIFT_create()
kp, des = sift.detect(img, None)

https://docs.opencv.org/3.1.0/da/df5/...

edit retag flag offensive close merge delete

Comments

wait, (x,y,scale,orient), is (some part of) the keypoint, but the corresponding descriptor is indeed 128 floats.

you're comparing apples to oranges, somehow.

berak gravatar imageberak ( 2018-01-25 11:19:23 -0600 )edit

What I initially wrote wasn't completely correct. When using sift.detect() only the keypoints, kp, are returned. Keypoints is a list with angle, point, class_id, octave, response and size. The histogram descriptors, des, are not returned. So I'm still not sure what is causing the memory issue. I can run my 160 MB image with Matlab VLFEAT but it causes OpenCV SIFT to max out my memory usage to 100% and the computer crashes.

rab4280 gravatar imagerab4280 ( 2018-01-25 13:03:34 -0600 )edit

sorry, but you'll have to start all over from the beginning. -- what are you trying to achieve ?

berak gravatar imageberak ( 2018-01-25 13:11:12 -0600 )edit

I want to run SIFT using Python OpenCV on a large image. When I try to process it, I've either gotten an error message about memory allocation or I've had the memory usage shoot to 100% and the computer crashes. I want to understand why this is happening and what other options I have.

rab4280 gravatar imagerab4280 ( 2018-01-25 15:34:59 -0600 )edit