问题:
我在MVID_CR_CAM_RegisterImageBufferCallBack注册图像回调函数中,得到相机的原始图像后 调用MVID_CR_Process进行条码解析 失败,返回:返回0x80002200 一维码相关错误
代码如下:
// MVID_CR_CAM_RegisterImageBufferCallBack的回调函数
void __stdcall RegisterImgBuffCall(MVID_IMAGE_INFO* pstPreOutput,void* pUser)
{
MainWindow* pThis = (MainWindow *)pUser;
if(pThis){
QDateTime current_date_time =QDateTime::currentDateTime();
codedata.time =current_date_time.toString("yyyy-MM-dd hh:mm:ss.zzz ");
if( pstPreOutput->pImageBuf = nullptr ){
qDebug()<<codedata.time;
return;
}
Img.pImageBuf = pstPreOutput->pImageBuf;
Img.nImageLen = pstPreOutput->nImageLen;
Img.enImageType = pstPreOutput->enImageType;
qDebug()<<"Input Image type = "<<pstPreOutput->enImageType;
Img.nWidth = pstPreOutput->nWidth;
Img.nHeight = pstPreOutput->nHeight;
pThis->ImgCallBack(Img);
}
}
void MainWindow::ImgCallBack(MVID_PROC_PARAM data)
{
uint ret = MVID_CR_Process(m_hDevHandle,&data,MVID_BCR) ;
if( ret != MVID_CR_OK ){
qDebug()<< " MVID_CR_Process error : "<<ret;
return;
}
for( int i = 0 ; i < data.stCodeList.nCodeNum ; ++i){
QString str = QString::fromLocal8Bit((char *)data.stCodeList.stCodeInfo[i].strCode) + "," + codedata.time;
qDebug()<< str;
}
return ;
}
运行后的输出 :
Input Image type = 1
MVID_CR_Process error : 2147492352
从输出结果得出:
MVID_IMAGE_MONO8 = 1, // ch:Mono8 | en:MONO8 format
输入的图像类型是: MONO8
2147492352 对应的16进制是 0x80002200
#define MVID_CR_E_BCR 0x80002200 ///< ch:一维码相关错误 | en:1D barcode error
疑问:
请问MVID_CR_Process 的参数如何正确设置 ,才返回条码信息
相关函数结构体参考如下:
探寻机器视觉新星|第二届“启智杯”机器视觉设计大赛获奖名单公布
2024-04-08 16:39:23