void MatNDReadAndSet()
{
int M = 192;
int N = 168;
int K = 7;
int size[] = { M, N, K };
CvMatND* mXOrigin = cvCreateMatND( 3, size, CV_32FC1 );
cvSetZero( mXOrigin );
float c = 0;
for ( int k=0; k<K ; k++)
{
for ( int i=0; i<M; i++)
{
for ( int j=0; j<N; j++)
{
*(mXOrigin->data.fl + ( M*N*k + N*i + j) ) = c;
c = c+1;
}
}
}
for ( int k=0; k<K; k++)
{
for ( int i=0; i<M; i++)
{
for ( int j=0; j<N; j++)
{
cout << *(mXOrigin->data.fl + ( M*N*k + N*i + j) ) << "\t";
}
cout << endl;
}
cout << endl;
}
cvReleaseMatND( &mXOrigin );
}