QT顯示呼叫C++編譯的dll
//定義函式指標:
typedef cv::Mat(*Fun)(std::string); //定義函式指標,以備呼叫
.
.
.
.
void ImageMaster_Pro::Img_stich()
{
QString imgpath = QFileDialog::getExistingDirectory(this, "待拼接影像檔案夾", "./", QFileDialog::ShowDirsOnly);
QLibrary mylib("ImgStiching_dll.dll"); //宣告所用到的dll檔案
if (imgpath.isEmpty())
{
return;
}
else
{
cv::Mat result;
if (mylib.load()) //判斷是否正確加載
{
Fun open = (Fun)mylib.resolve("ImgStich"); //援引 add() 函式
if (open) //是否成功連接上 add() 函式
{
result = open(imgpath.toStdString());
QImage outimg;
QString savepath = "1.jpg";
cv::imwrite(savepath.toStdString(), result);
outimg.load(savepath);
ShowImage(outimg, true);
}
else
QMessageBox::information(NULL, "NO", "Linke to Function is not OK!!!!");
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/274122.html
標籤:其他
