Repository: opencv
Issue: A big push for sparse support!
Labels: auto-transferred,priority: normal,feature,category: core

Transferred from http://code.opencv.org/issues/2309

```
|| Hilton Bristow on 2012-08-26 07:07
|| Priority: Normal
|| Affected: None
|| Category: core
|| Tracker: Feature
|| Difficulty: None
|| PR: None
|| Platform: None / None
```
## A big push for sparse support!

```
In the lead-up to version 2.5, it would be great to have a big push towards better sparse matrix support in OpenCV. Since sparse matrices are currently not supported at all (no primitive operations +, *, etc) this gives us a great opportunity to talk to the community and ask what they want from sparse matrices, and I'd like to get the conversation started.

Here's what's on the top of my list:
* new optimization module
* make SuiteSparse or Ceres a dependency, and rebuild sparse support around their data structures
* more matlab-esque operations, including accessors [], (), full(), and better sparse support for existing functions, abs(), norm(), inv()

What are the challenges involved in making this happen, and is it possible to absorb libraries like SuiteSparse which already have good sparse support? Can we start a public forum to throw around ideas? Either at ECCV or online?
```
## History
##### Daniel Moodie on 2015-02-03 16:09

```
Hilton Bristow wrote:
> In the lead-up to version 2.5, it would be great to have a big push towards better sparse matrix support in OpenCV. Since sparse matrices are currently not supported at all (no primitive operations +, *, etc) this gives us a great opportunity to talk to the community and ask what they want from sparse matrices, and I'd like to get the conversation started.
> 
> Here's what's on the top of my list:
> * new optimization module
> * make SuiteSparse or Ceres a dependency, and rebuild sparse support around their data structures
> * more matlab-esque operations, including accessors [], (), full(), and better sparse support for existing functions, abs(), norm(), inv()
> 
> What are the challenges involved in making this happen, and is it possible to absorb libraries like SuiteSparse which already have good sparse support? Can we start a public forum to throw around ideas? Either at ECCV or online?

I would absolutely love SuiteSparse or Ceres integration!
```
##### Alex Susu on 2015-02-12 15:58

```
Hello.
    I believe a better format for efficiency for sparse matrix representation should be CSR/CSC, not DOK (Dictionary of Keys), as it is right now. I personally recommend using bebop.cs.berkeley.edu/oski/ since it seems to support more sparse matrix formats.

    Also, we need to use in OpenCV operations on sparse matrices such as warpPerspective, etc which boil down to 
remap() (http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html?highlight=remap#remap) .
A trivial implementation would require DOK or LIL sparse matrix format. But, I was able to implement some of the 
remap operations using the CSR/CSC format, although it's a bit tricky.

    Although this I guess does not encourage highest performance, it would also be nice to derive cv::SparseMat 
from cv::Mat and make it's interface compatible with cv::Mat in order to have operations like warpPerspective() 
and remap() support directly SparseMat.

    Please let me know what are your thoughts on these issues.

  Thank you,
     Alex
```