mark-puls 2022-11-25 14:38 采纳率: 0%
浏览 7

QT调用OpenCV3.4.2中OrbFeaturesFinder类来寻找图片特征,出现以下错误

问题遇到的现象和发生背景

void MainWindow::on_tbOrbPoint_clicked()
{
try
{
destroyAllWindows();

    //读入图像
    QString sPathSrc = ui->lePath2->text();
    Mat matSrc = imread(sPathSrc.toLocal8Bit().data());
    //OrbFeaturesFinder(Size _grid_size = Size(3,1), int nfeatures=1500, float scaleFactor=1.3f, int nlevels=5);

    QTime tm;
    tm.restart();

    //应用ORB 寻找特征检测
    int iGridW = ui->sbGridW->value();
    int iGridH = ui->sbGridH->value();
    int iNfeatures = ui->sbNfeatures->value();
    float fScaleFactor = ui->sbScaleFactor->value();
    int iNlevels = ui->sbNlevels->value();
    Ptr<FeaturesFinder> finder = new OrbFeaturesFinder(Size(iGridW, iGridH), iNfeatures, fScaleFactor, iNlevels);
    //OrbFeaturesFinder* finder = new OrbFeaturesFinder(Size(iGridW, iGridH), iNfeatures, fScaleFactor, iNlevels);

    ImageFeatures features;         //特征点信息
    (*finder)(matSrc, features);    //寻找特征检测

    ui->sbOrbTime->setValue(tm.elapsed());

    //调用drawKeypoints函数绘制特征
    Mat matDst;
    drawKeypoints(matSrc, features.keypoints, matDst, Scalar::all(-1));

    namedWindow("matDst");
    imshow("matDst", matDst);
    moveWindow("matDst", 1920, 0);

    QString sPathDst = Local_Path + "/Orb.bmp";
    imwrite(sPathDst.toLocal8Bit().data(), matDst);
}
catch (cv::Exception e)
{
    qDebug() << e.msg.c_str();
}
catch (exception &e)
{
    qDebug() << e.what() << 11;;
}

}

用代码块功能插入代码,请勿粘贴截图

img

  • 写回答

1条回答 默认 最新

  • 赵4老师 2022-11-25 14:56
    关注

    崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack即“调用堆栈”里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止。

    评论

报告相同问题?

问题事件

  • 创建了问题 11月25日