c ++/cliを使用して画像をバイト配列に送信する必要があります。画像は最初はIplimage形式です。
int img_sz1 = img1->width * img1->height * img1->nChannels;
array <Byte>^ hh1 = gcnew array<Byte> (img_sz1);
Marshal::Copy( (IntPtr)img->imageData, hh1, 0, img_sz1 );
そしてそれはうまく働いていました。
jpegとして送信するためのエンコード手順を追加しました
CvMat* buf1 = cvEncodeImage(".jpeg", img1, jpeg_params);
img_sz1=buf1->width*buf1->height
Marshal::Copy( (IntPtr)buf1, hh1, 0, img_sz1 );
そして今、それはうまくコンパイルされますが、marshal:copy行でエラーが発生します
An unhandled exception of type 'System.AccessViolationException' occurred in
mscorlib.dll. Additional information: Attempted to read or write protected memory.
どんな助けでも大歓迎です。