导读:
//在用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
}
}
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1863721
本文转自
http://blog.csdn.net/hongjiujing/archive/2007/11/02/1863721.aspx
//在用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
}
}
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1863721
本文转自
http://blog.csdn.net/hongjiujing/archive/2007/11/02/1863721.aspx
本文介绍如何使用QT进行摄像头图像捕获及RGB565到RGB24格式转换的方法。通过创建QImage对象来保存和展示从摄像头获取的图像数据。

571

被折叠的 条评论
为什么被折叠?



