I am implementing an image processing algorithm in C++ using openCV, in which the 1st step requires that the image be converted to a matrix. I know that when an image is loaded into openCV, it is already stored as a matrix. The image that I am using is of size 80 x 60, so I am assuming that the matrix it is stored in is of size 80 x 60. However, I would like to first be able to see this matrix and then be able to reshape it into a matrix with the same no. of pixels but as one long column instead. i.e. the 80 x 60 matrix would now become a 4800 x 1 matrix. I have tried researching textbooks and online but to no avail. This is my code so far. In any case, it is not working because I cannot cannot convert from 'IplImage *' to 'CvMat * but how else I am supposed to assign my pixel values to the matrix after creating it? Please, I would greatly appreciate if someone could help me with this code.
#include "cv.h"
#include "highgui.h"
#include "iostream"
using namespace std;
int main( int argc, char* argv ) {
IplImage* img0 = NULL;
CvMat* img0_mat = NULL ;
img0 = cvLoadImage("C:\\new\\walk mii.jpg");
if (!img0){
return -1;}
img0_mat = cvCreateMat(80, 60, 1);
img0_mat = img0;
cout <<" matrix " << img0 << endl;
cvWaitKey(0);
return 0;
}