看起来好像QImage支持几种从像素阵列加载的方式。
QImage(const uchar *data, int width, int height, Format format)
bool QImage::loadFromData(const uchar *buf, int len, const char *format=0)
使用的第一个例子,如果你有你提到的阵列,那么你可能会希望使用的格式的QImage :: Format_RGB888(从qimage.h)。
您需要自己知道宽度和高度。
最后你会想重新包装数组到一个单一的UCHAR *阵列
uchar* rgb_array = new uchar[19200+19200+19200];
for(int i = 0, j = 0; j < 19200; ++j)
{
// here we convert from the double range 0..1 to the integer range 0..255
rgb_array[i++] = r[j] * 255;
rgb_array[i++] = g[j] * 255;
rgb_array[i++] = b[j] * 255;
}
{
QImage my_image(rgb_array, width, height, QImage::Format_RGB888);
// do stuff with my_image...
}
delete[] rgb_array; // note you need to hold onto this array while the image still exists