Ask Your Question
1

Support for large sized matrices

asked 2014-01-19 12:54:18 -0600

sushantt gravatar image

Hi everyone, I am new to this community forum so I apologise in advance if I have mis-posted this question in the wrong section. Also, I have performed a diligent Google search of this before posting.

So here goes:

The OpenCV Mat class defines rows and cols to be int, I have a particular problem in which I have to read in SIFT descriptors from ~100,000 images and then try to cluster them. The clustering algorithm needs to see the whole input set as one Mat. So, is there any (even hacky) way to redefine the Mat to have long rows and cols.

Thanks in advance for any inputs regarding this.

edit retag flag offensive close merge delete

Comments

How big is your matrix? What kind of errors do you get?

Nghia gravatar imageNghia ( 2014-01-19 17:37:48 -0600 )edit

I am wondering why this shouldn't work... A feature vector exists of some single bytes that need to be stored in memory. This will lead to some MB of memory needed, not more. Since the Mat format is using a pointer assignment in memory, it should be possible to create such a large Mat elements. What is going wrong?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-21 02:38:11 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-01-21 02:44:22 -0600

I just did some small test. The following code performs exactly what you want, creating a large sized matrix:

#include "opencv2\opencv.hpp";

using namespace std;
using namespace cv;

int _tmain(int argc, _TCHAR* argv[])
{
    Mat test_matrix = Mat::zeros(100000, 5000, CV_8UC1);
    cout << "It works!" << endl;

    return 0;
}

It creates a matrix of zeros (with possible integer values as descriptor value) the size of the descriptor has been arbitrarily set to 5000 which is large, but could even be larger.

I guess you are running in problems with your clustering? Care to explain in more detail?

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-01-19 12:54:18 -0600

Seen: 595 times

Last updated: Jan 21 '14