QFileDialog fileDlg;
QString imgFile = fileDlg.getOpenFileName(this, QString::fromLocal8Bit("加载图片"), "D:\\", QString::fromLocal8Bit("图片(*jpg *png *bmp *dfx)"));
QFileInfo fileInf(imgFile);
if (!fileInf.exists())
{
QMessageBox::warning(this, QString::fromLocal8Bit("警告"), QString::fromLocal8Bit("警告:所选择的的文件不存在!"), QMessageBox::Ok);
return;
}
else
{
std::string pathStr = imgFile.toLocal8Bit();
cv::Mat src = imread(pathStr.c_str());
}
QT读取文件夹图片
最新推荐文章于 2024-06-19 22:24:36 发布