VL.OpenCV - Getting flat values out


I’m was wondering what the best method was for getting a flat array of floats from a CVImage/Mat.

I tried the approach below but it wasn’t successful.


Any pointers (no pun intended, but if they’re fast…)?

Small update,
I obviously didn’t have the getarray setup right, but this looks closer:

but I get this error:

Mat data type is not compatible: CV_8UC3

Before we try to do it your way, does the ToValues (OpenCV.Conversion) node do what you need?

It will give you a Spread<Spread<Spread< T >>>> (Channels, Rows, Cols) that you can later flatten.

Begun to get that working but I’m already worried about the speed.

I haven’t properly converted the bytes to floats at this point, which may add a little extra overhead.


Visualizing an Image in an IOBox seems like a bad idea performance-wise, also you probably want to cache the ToValues+Flattens or is it a constantly changing image?

If performance is your concern, then go for a Ptr, use Image GetData combined with ImageData Pointer

That’ll be something like this then:


I’ll have a look at the final pointer-to-data step and get back to you.
Thanks @ravazquez !!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.