search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

QT5 + OPENCV4.11(VC14~Visual studio 2015)X64 DLL [開發環境 測試] – jashliao部落格

QT5 + OPENCV4.11(VC14~Visual studio 2015)X64 DLL [開發環境 測試]


資料來源:https://www.796t.com/post/NHhmNWk=.html

https://blog.csdn.net/qq_38965737/article/details/102595908


GITHUB:https://github.com/jash-git/OPENCV411_VC14DLL


01.內含函數庫引用+console程式設定

#opencv.pri
# 宏定义项,指明采用OPENCV
DEFINES += OPENCV_DLL

# 指明GSL库所对应的头文件所在目录
INCLUDEPATH += $$PWD/include

# 指明依赖库关系
LIBS += $$PWD/lib/opencv_world411.lib
LIBS += $$PWD/lib/opencv_world411d.lib

02.code:

#include 
#include 
#include 
#include 
#include 

using namespace cv;

void pause()
{
    printf("Press Enter key to continue...");
    fgetc(stdin);
}
void opencv_testfun01()
{
    /* 畫布 */
    Mat img(270, 720, CV_8UC3, Scalar(56, 50, 38));
    /* 直線 */
    line(img, Point(20, 40), Point(120, 140), Scalar(255, 0, 0), 3);
    /* 實心方塊 */
    rectangle(img, Point(150, 40), Point(250, 140), Scalar(0, 0, 255), -1);
    /* 實心圓 */
    circle(img, Point(330, 90), 50, Scalar(0, 255, 0), -1);
    /* 空心橢圓 */
    ellipse(img, Point(460, 90), Size(60, 40), 45, 0, 360, Scalar(255, 255, 0), 2);
    /* 不規則圖形 */
    Point points[1][5];
    int x = 40, y = 540;
    points[0][0] = Point(0 + y, 50 + x);
    points[0][1] = Point(40 + y, 0 + x);
    points[0][2] = Point(110 + y, 35 + x);
    points[0][3] = Point(74 + y, 76 + x);
    points[0][4] = Point(28 + y, 96 + x);
    const Point* ppt[1] = { points[0] };
    int npt[] = { 5 };
    polylines(img, ppt, npt, 1, 1, Scalar(0, 255, 255), 3);
    /* 繪出文字 */
    putText(img, "Test Passed !!", Point(10, 230), 0, 3, Scalar(255, 170, 130), 3);
    /* 開啟畫布 */
    namedWindow("OpenCV Test By:Charlotte.HonG", WINDOW_AUTOSIZE);
    imshow("OpenCV Test By:Charlotte.HonG", img);
    waitKey(0);
}
void opencv_testfun02()
{
    Mat img = imread("l_hires.jpg", IMREAD_COLOR);

    imshow("Display window", img);
    waitKey(0);
}
int main(int argc, char *argv[])
{
    opencv_testfun02();
    return 0;
}



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦