I am trying to use cvReshape to have 2 versions of the same matrix data. For example, gray_img is a 100x100 matrix, and gray_line is a 10000x1 matrix, pointing to the same data, but with a different header. This is what I do in OpenCV following the documentation:
CvMat * gray_img;
CvMat gray_line_header;
CvMat * gray_line;
gray_img = cvCreateImage(100, 100, IPL_DEPTH_32F, 1);
gray_line = cvReshape(gray_img, &gray_line_header, 0, 10000);
It works as intentional, but I feel that it is difficult to read, not elegant. If I understand correctly, gray_line will point to gray_line_header, so I feel that there is an additional variable here. Is it possible to do what I want without declaring the matrix header or only with ads from 2 (instead of 3)?
thank
source
share