Why does the assertion fail here when i create a CvMat *? It does not happen with an image i load in cv::Mat using a pointer.
CvMat *
struct RGB { unsig
Because sizeof(RGB) != sizeof(float), which is what you filled the matrix with here:
sizeof(RGB) != sizeof(float)
CvMat* mat = cvCreateMat(300,300,CV_32FC1);
CV_32FC1 means 1 component, 32-bit floating point. You probably want CV_8UC3. See here or another OpenCV reference.
CV_32FC1
CV_8UC3