0

I am working in C++ OpenCV and I am trying to solve a traditional normal integration problem; however, to do that, I need to define a matrix with size (2*n_pixels, n_pixels), i.e. (350000, 175000) in my case, each line of which will be filled with only two numbers (a 1 and a -1). I tried to define it as a cv::Mat, but the computation becomes terribly slow. Thus, I thought about using a cv::SparseMat as an alternative, which works very well, but I need to transpose it and when I try I get the compilation error error C2039: 't': is not a member of 'cv::SparseMat', which I suppose it means that transposition is not defined for cv::SparseMats. How can I solve this?

Eggman
  • 53
  • 2
  • 14
  • I dont have much experience with sparse matrices. Are you able to iterate over all set values and get their element-position? If yes, you could write your own transpose function, iterate manually and set the transposed coordinates in another sparse mat. But probably that's not what you want to do? – Micka Aug 02 '18 at 11:59
  • That should be actually right! I will try it and let you know how it goes. – Eggman Aug 02 '18 at 12:05
  • I also had to multiply the matrix by its transposed, and it takes hours to do that if I do it manually... – Eggman Aug 02 '18 at 14:22
  • probably for multiplying such big (but sparse) matrices you'll have to find some smart optimization that omits most of all elements, but not sure whether this is possible. – Micka Aug 02 '18 at 16:34
  • 1
    https://stackoverflow.com/questions/15693584/fast-sparse-matrix-multiplication – Micka Aug 02 '18 at 16:37

0 Answers0