DVP:
dvpFrame pFrame;//图像帧数据
void* pBuffer;//帧数据地址
dvpStatus statu;
statu = dvpGetFrame(CameraHandle_t, &pFrame, &pBuffer, 3000);
QImage tmpImg((uchar*)pBuffer, pFrame.iWidth, pFrame.iHeight, QImage::Format_Indexed8);//BGR24-Format_BGR888\MONO8、16、RAW8-Format_Indexed8\RAW12-Format_Grayscale16
QImage r_image = tmpImg.scaled(tmpImg.width() * 0.5, tmpImg.height() * 0.5, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);//缩放图像,SmoothTransformation平滑缩放,FastTransformation快速缩放
ui.label->setPixmap(QPixmap::fromImage(r_image));//贴图到Label
相机输出格式 | QImage转换格式 |
---|---|
BGR24 | Format_BGR888 |
MONO8、16、RAW8 | Format_Indexed8 |
RAW12 | Format_Grayscale16 |
MD:
tSdkFrameHead pFrameInfo;//图像的帧头信息指针
BYTE* pbyBuffer;//指向图像的数据的缓冲区指针
CameraGetImageBuffer(pCameraHandle, &pFrameInfo, &pbyBuffer, 3000);//获取一帧图像数据
QImage tmpImg((uchar*)pbyBuffer, 1280, 1024, QImage::Format_Indexed8);
QImage r_image = tmpImg.scaled(tmpImg.width() * 0.5, tmpImg.height() * 0.5, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);//缩放图像,SmoothTransformation平滑缩放,FastTransformation快速缩放
ui.label->setPixmap(QPixmap::fromImage(tmpImg));
CameraReleaseImageBuffer(pCameraHandle, pbyBuffer);//释放由CameraGetImageBuffer获得的缓冲区
不是很懂他们的API,输出的彩色格式转换老是报错,然后硬是用彩色相机输出了黑白图像,绝了