问题遇到的现象和发生背景
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;;
}
}