QT的QImage 用scaled只能缩放Format_RGB888 不能缩放 Format_Indexed8
项目是读取大恒相机的图像并显示出来
硬件:IMX6的开发板
软件:ubuntu qt
摄像头输出格式:raw 8 (黑白)
问题:摄像头读取数据正常,摄像头像素1280*1024 显示区域 300*200
情况1,如将摄像头读取的数据转换为Format_Indexed8用Scaled缩放,直接显示为空白,(如不缩放,可正常显示)
转换函数:QImage img3 = QImage((const unsigned char *)image_buffers[buf.index].start,g_nSetWidth,g_nSetHeight,QImage::Format_Indexed8);
显示函数:
QImage newimg3 = img3.scaled(220,140,Qt::KeepAspectRatio);
ui->label_show->setPixmap(QPixmap::fromImage(newimg3));
情况2,如将摄像头读取的数据转换为Format_RGB888但用Scaled缩放,显示有9(行3 列3)幅图像,3幅正常
转换函数:QImage img3 = QImage((const unsigned char *)image_buffers[buf.index].start,g_nSetWidth,g_nSetHeight,QImage::Format_Indexed8);
显示函数:
QImage newimg3 = img3.scaled(220,140,Qt::KeepAspectRatio);
ui->label_show->setPixmap(QPixmap::fromImage(newimg3));
请问怎么才能正常显示一幅正常的图像啊?跪求