I implement an image processing algorithm in C ++ using openCV, in which the first step is to convert the image to a matrix. I know that when an image is uploaded to openCV, it is already saved as a matrix. The image that I use is 80 x 60 in size, so I assume that the matrix in which it is stored is 80 x 60 in size. However, I would like to see this matrix first, and then be able to resize it to a matrix with that same number. pixels, but instead uses one long column. those. the 80 x 60 matrix will now become the 4800 x 1 matrix. I tried to research textbooks online, but to no avail. This is my code so far. In any case, it does not work, because I cannot convert from "IplImage" to "CvMat",but how else should I assign pixel values ββin the matrix after creating it? Please, I would really appreciate if someone would 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;
}