Ask Your Question

Revision history [back]

You have to cvCreateImageHeader instead of cvCreateImage

unsigned char* buffer;
int width = 100;
int height = 100;
IplImage* img1 =    cvCreateImageHeader(cvSize(width,height),IPL_DEPTH_8U,4);
cvSetData(img1,buffer,img1->widthStep);