uchar* pImageData = (uchar*)malloc(width*height* 3 * sizeof(uchar));
Mat MyImage = imread(file_name,IMREAD_COLOR);
if(!MyImage.data){
cout<< "读取不到图片" << endl;
return0;
}
for(int i = 0; i < height; i++)
{
constuchar* current = MyImage.ptr<uchar>(i);
for(int j = 0; j < width; j++)
{
pImageData[i*width* 3 + 3 * j + 0] = current[3 * j + 0];
pImageData[i*width * 3+ 3 * j + 1] = current[3 * j + 1];
pImageData[i*width * 3+ 3 * j + 2] = current[3 * j + 2];
}
}