Feature Matching Large images [closed]

asked 2016-02-11 07:21:53 -0600

KirbX gravatar image

updated 2016-02-11 08:12:35 -0600

Hello everyone! I have a little problem with the feature matching. I'm using this method with Ptr<SurfFeatureDetector> detector = SurfFeatureDetector::create(minHessian); instead of SurfFeatureDetector detector( minHessian );

But I'm using it with enormous images (72Mb / 11804 * 5850px) and when I start the program, my computer freeze! It just freeze! Nothing works any more. I just waited 30mn and nothing happened. I was wondering if there is a method that can work to do feature matching with those big images (like, if the L2-SIFT is implemented?)

Thanks in advance :) Have a nice day everyone! :)

Edit : Sorry, that's right I didn't give informations. I'm actually on Windows 7 SP1, using a DELL with 4Gb RAM. I'm working with OpenCV 3.1.0 And the code I have is :

Mat img_1 = imread("... /*Large image*/", IMREAD_GRAYSCALE);
Mat img_2 = imread("..."/*Little image*/, IMREAD_GRAYSCALE);

//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400;

Ptr<SurfFeatureDetector> detector = SurfFeatureDetector::create(minHessian);
//SurfFeatureDetector detector(minHessian);

std::vector<KeyPoint> keypoints_1, keypoints_2;

detector->detect(img_1, keypoints_1);
detector->detect(img_2, keypoints_2);
std::cout << " Step 1" << std::endl;

and my computer doesn't type "Step 1" in the console, so I suppose the problem come from detector->detect(img_1, keypoints_1);

I know it works when I resize img_1 by a factor of 0.5 . So I'm sure it's a memory problem.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-07 12:38:42.444722

Comments

First set of questions

  1. What is your setup: OS, hardware, ... ?
  2. What OpenCV version are you using?
  3. Can you supply the full code instead of just pointers to tutorials? Typos are faster made then you think and can do the most weird things ever.

Once you have update your question, stuff will become more clear!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-11 08:00:32 -0600 )edit

I have now edit my question, maybe it'll be more understandable.

KirbX gravatar imageKirbX ( 2016-02-11 08:13:12 -0600 )edit

a DELL with 4Gb RAM and I know it works when I resize img_1 by a factor of 0.5 . So I'm sure it's a memory problem. --> then I guess the conclusion is pretty straightforward. The calculation of your features and the matching on such an image needs more than 4GB of RAM (because not everything is assigned to OpenCV) and thus your PC starts memory swapping which is VERY slow and clogs up the computer!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-11 09:03:20 -0600 )edit

That's why my question is to know if there is a function implemented for big images, such as L2-SIFT (that is SIFT that work with blocks of the big image) or something like this :)

KirbX gravatar imageKirbX ( 2016-02-11 09:39:06 -0600 )edit

It is not off the shelf available, but how about cutting it manually into parts and processing them one by one?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-12 03:05:19 -0600 )edit

Yup, that's right I could do it myself, and I will probably, if there is no other solution :). But actually, the results are quit bad :/ I'm trying to match forest images, and results are unusable ^^ So first, I have to solve this problem ^^

KirbX gravatar imageKirbX ( 2016-02-12 03:27:10 -0600 )edit

match forest images --> oh boy ... I can imagine about 1000 reasons why this will not work. The info is just way to general to use keypoint matching... unless there are like unique structures in this forest like castles or towers or so ...

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-12 04:16:15 -0600 )edit
1

I'm always optimistic when I start a project! :) I use the worst case every time to be sure it'll work everywhere ;) But, I made my own SIFT implementation and strangely, it works well in the forest (or maybe it's because it's not very effective that it's more effective? I don't know) But it takes me long time to do it. So I wanted something that I can use faster :) Maybe I'll have to continue on my way ^^

KirbX gravatar imageKirbX ( 2016-02-12 04:45:02 -0600 )edit

Good luck!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-12 05:02:11 -0600 )edit

Thanks! :D Maybe can I ask you if you know how to do a good Best Bin First algorithm with vectors dimensions 128? I can't find any informations about this algorithm...

KirbX gravatar imageKirbX ( 2016-02-12 06:46:14 -0600 )edit