Qt 打开海康威视工业相机 在将缓存数据转为QImage格式之后,点击采集,在lable中显示一片绿色,怎么回事?
int myCamer::ReadBuffer() { unsigned int nRecvBufSize = 0; MVCC_INTVALUE stParam; memset(&stParam, 0, sizeof(MVCC_INTVALUE)); int temp = MV_CC_GetIntValue(m_hDevHandle, "PayloadSize",&stParam); if (temp != 0) { return -1; } else { qDebug()<<"succ read"; } nRecvBufSize = stParam.nCurValue; // qDebug()<<"the nrbs:"<<nRecvBufSize; m_pBufForDriver = (unsigned char *)malloc(nRecvBufSize); MV_FRAME_OUT_INFO_EX stImageInfo; int tempValue= MV_CC_GetOneFrameTimeout(m_hDevHandle,m_pBufForDriver, nRecvBufSize, &stImageInfo,1000); if(tempValue!=0) { qDebug()<<"false get"<<tempValue; return -1; } else { qDebug()<<"succ get"; } QImage *saveAsImage = new QImage(stImageInfo.nWidth,stImageInfo.nHeight,QImage::Format_Indexed8); qDebug()<<"succ saveas"; memcpy((*saveAsImage).bits(),m_pBufForDriver,stImageInfo.nWidth*stImageInfo.nHeight); qDebug()<<"succ memcpy"; bool flag_1 = saveAsImage->save("C:\\Users\\simon\\Desktop\\pic\\test01.bmp"); if(flag_1) { qDebug()<<"succ save"; } else { qDebug()<<"false save"; } return 0; }
Qt和海康威视混合编程
最新推荐文章于 2024-06-28 15:38:26 发布