LumiGuide / haskell-opencv

Haskell binding to OpenCV-3.x
Other
154 stars 44 forks source link

Consider using massiv instead of repa #110

Open basvandijk opened 6 years ago

basvandijk commented 6 years ago

The massiv array library looks like an improved and maintained alternative to repa. We should consider writing an adapter for OpenCV Mats for massiv Arrays like we do for repa Arrays.

@lehins massiv looks pretty cool! Do you think it's possible to write an adapter between OpenCV Mats and massiv Arrays so that we can read and write OpenCV Mats using the massiv API?

Note that one thing that is missing is that we don't have an instance for the repa Target class. This means that we can't actually write OpenCV Mats using repa. I wonder if we can do this in massiv.

lehins commented 6 years ago

@basvandijk This is a great idea. I don't see any reason why OpenCV Mats can't be used together with massiv. There are few class instances that need to be implemented: Construct, Size and Source and Manifest for pure interface: ability to create, index, extract and resize arrays, which I suspect should be similar to the way Repa is integrated right now. And also an instance for Mutable (a corresponding Target class in Repa), which should be possible, considering that Mat is just a pointer to memory that we can peek and poke. Let me know if you have any questions or need any help with it. I could try doing that myself, but I won't have time for another couple of weeks. If you won't have any progress on that I'll take a stab at it then.