Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Best way to store a Mat object in Android

What is the best way to store a Mat object in Android? (there is a similar, unanswered, question here)

In image processing apps; it requires quite a lot of processing time to perform necessary pipelines which could be redundant. Thus, Mats would be preferably stored to prevent re-computation every time. I considered using SQLlite databases, but those seem to add unnecessary complexity in reading and writing Mat objects, where the method I understand would be writing each individual pixel in a Mat object in a separate row.

I came across solutions (regarding saving custom classes, not OpenCV in specific) that suggested saving the file externally to the SD card. That seems quite plausible, but the problem is that class Mat must implement Serializable class (according to many online references, as here), which is not the case. I don't wish to alter OpenCV's library albeit being open source, because I don't have much experience around the library.

Are there any time, and memory, efficient ways to preserving Mat objects for later launches of the app?

Thank you for your time.