opencv を使用して画像を表示する際に問題が発生しています。私のコードは現在動作しているので、サイズが 710X710 の unsigned short の 78 個の画像を単一の配列にロードする関数があります。データをファイルに書き込んでimageJで読み取ることで、これが機能することを確認しました。現在、配列から単一の画像フレームを抽出し、それを Mat にロードして処理を実行しようとしています。今、私はこれを行うために2つの方法を試しました。出力を読み取ろうとしない場合、コードはコンパイルおよび実行されますが、cout<
私の質問は、サイズが 710*710 の 78 個の画像の大きな 1 次元配列からデータを単一の Mat 画像に抽出するにはどうすればよいかということです。または、画像を寸法 710X710X78 の 3-D マットにロードし、必要に応じて各 710X710 スライスで操作できる、より効率的な方法はありますか?
int main(int argc, char *argv[])
{
Mat OriginalMat, TestImage;
long int VImageSize = 710*710;
int NumberofPlanes = 78;
int FrameNum = 150;
unsigned short int *PlaneStack = new unsigned short int[NumberofPlanes*VImageSize];
unsigned short int *testplane = new unsigned short int[VImageSize];
/////Load PlaneStack/////
Load_Vimage(PlaneStack, Path, NumberofPlanes);
//Here I try to extract a single plane image to the mat testplane, I try it two different ways with the same results
memcpy(testplane, &PlaneStack[710*710*40], VImageSize*sizeof(unsigned short int));
//copy(&PlaneStack[VImageSize*40],&PlaneStack[VImageSize*41], testplane);
// move single plane to a mat file
OriginalMat = Mat(710,710,CV_8U, &testplane) ;
//cout<<OriginalMat;
namedWindow("Original");
imshow("Original", OriginalMat);
}