What is the most efficient matrix representation in C ++?

I hope this question does not apply to OT.

I implement VLAD using the VLFeat implementation and SIFT descriptors from different implementations to compare them (OpenCV, VLFeat, OpenSIFT ).

This should be a high-performance C ++ application (I know that SIFT is very inefficient, I am implementing its parallel version).

Now VLAD wants to enter a pointer to a set of contiguous descriptors (mathematical vectors). The fact is that usually these SIFT descriptors are presented in the form of a matrix, so they are easier to manage.

So, suppose we have a matrix of 3 descriptors in three dimensions (I use these numbers for simplicity, in fact these are thousands of descriptors in 128 dimensions):

1 2 3
4 5 6
7 8 9

I need to make a feed vl_vlad_encodewith a pointer to:

1 2 3 4 5 6 7 8 9

The direct solution is to store the descriptors in the object cv::Mat m, and then pass m.datain vl_vlad_encode.

However, I do not know if cv::Matmatrix representation is efficient. For example, it Eigen::Matrixis an alternative (I think it’s easy to get a view above using this object), but I don’t know whose implementation is faster / more efficient or there is some other reason, because I should prefer one rather than the other.

Another possible alternative is to use std::vector<std::vector<float>> v, but I don’t know if I used the v.data()view above and not: 1 2 3 *something* 4 5 6 *something* 7 8 9

, *something* vl_vlad_encode.

!

+4
2

- (. ), Mat . Mat float* ( ), . , , .

/ / , Mat , matread matwrite.

+4

std::vector<std::vector<float>> v - , .

, float [], float [] [] std:: array/vector, , , . , ; , , , .

+1

Source: https://habr.com/ru/post/1663739/


All Articles