answered Dec 5 '12
I use
Mat src; src.create(cv::Size(cols,rows),CV_8UC1); for (int i=0;i<rows;i++) {="" memcpy(src.ptr(i),srcdata+i*cols,cols);="" }<="" p="">
Althougth,it's not very smart.But it can work