// 在用QT显示摄想头捕获的图象时用到的 // 创建一个QImage对象,用来保存RGB24图象 int x, y, r, g, b, i = 0 ;QRgb * point;unsigned char * image = get_image(fd, width, height, palette, & size); // 从摄像头获取RGB565图象 QImage * img = new QImage; // 保存转换后的图象 if (img -> create(width, height, depth, 0 , QImage:IngoreEndian) ... { for(y = 0; y < height; y++) ...{ for(x = 0; x < width; x++) ...{ r = ((int)img[i+1] & 0xf8) >> 3; g = (((int)img[i] & 0xe0) >> 5) | (((int)img[i+1] & 0x07) << 3); b = (int)img & 0x1f; point = (QRgb *)image->scanLine(y) + x; *point = qRgb(r, g, b); i += 2; } }}