My code:
float a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
CvMat b = cvMat( 3, 3, CV_32FC1, a );
float c[] = { 6, 7, 8, 9 };
CvMat d = cvMat( 2, 2, CV_32FC1, c );
CvMat* e = cvGetSubRect( &b, &d, cvRect( 0, 0, 1, 1 ) );
cout << *( e->data.fl + 0 ) << " " << *( e->data.fl + 1 ) << " " << *( e->data.fl + 2 ) << " " << *( e->data.fl + 3 ) << "\n";
The result: 1 2 3 4
But must be: 1 2 4 5
What am I doing wrong?