I'm trying to use OpenCV from Go. OpenCV defines a struct CvMat
that has a data
field:
typedef struct CvMat
{
...
union
{
uchar* ptr;
short* s;
} data;
}
I'm using the go bindings for opencv found here. This has a type alias for CvMat
:
type Mat C.CvMat
Now I have a Mat
object and I want to access the data
field on it. How can I do this? If I try to access _data
, it doesn't work. I printed out the fields on the Mat
object with the reflect
package and got this:
...
{data github.com/lazywei/go-opencv/opencv [8]uint8 24 [5] false}
...
So there is a data
field on it, but it's not even the same type. It's an array of 8 uint8
s! I'm looking for a uchar*
that is much longer than 8 characters. How do I get to this uchar
?