I am using native code in c #. I'm trying to pass an array of c # to c ++ using Pinvoke. Once in c ++, I want to fill that array that I passed as a parameter with the values of a cv :: Mat. The problem is that I'm using the copy function and I do not think that the parameters are going well. Can anybody help me? a greeting and thanks
C ++ CODE
__declspec(dllexport)
void video(unsigned char* arr) {
Mat frame;
Mat resi;
Mat dst;//dst image
camera >> frame;
if (frame.empty()) {
return;
}
flip(frame, dst,1);
//resize(dst, resi, Size(width, height));
cv::cvtColor(dst, dst, COLOR_BGR2RGB);
copy(dst.datastart, dst.dataend, arr);
}
CODE OF C #
[DllImport("NativoPrincipio")]
public static extern void video(byte[] img);
imgData = new byte[width * height* 4];
video(imgData);