Win10下QT5編譯_配置OpenCV_X32方法 [QT5 OPENCV_X32 WINDOWS]

Win10下QT5編譯_配置OpenCV_X32方法 [QT5 OPENCV_X32 WINDOWS]

Win10下QT5編譯_配置OpenCV_X32方法 [QT5 OPENCV_X32 WINDOWS]


opencv download:https://opencv.org/releases/


自行編譯OPENCV
https://www.codenong.com/cs106346328/
https://medium.com/@shinfu619_8469/%E7%B7%A8%E8%AD%AF%E6%94%AF%E6%8F%B4qt%E5%8F%8Aopengl%E7%9A%84opencv%E5%BA%AB-af699dbca563
https://zhuanlan.zhihu.com/p/344808567
https://tw511.com/a/01/10164.html
https://www.twblogs.net/a/5cae1cc0bd9eee340d9f8b7a

https://www.youtube.com/watch?v=Y-XM2RR7dRI


QT環境搭建: https://github.com/jash-git/QT5_Use_GSL

QT引用外部INCLUDE & LIB: https://github.com/jash-git/QT5_Use_GSL


GITHUB:https://github.com/jash-git/QT5-OPENCV_X32-WINDOWS


01.教學文件


02.編譯結果圖


03.code

#include <QCoreApplication>
#include <cstdio>
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

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_testfun01();
    opencv_testfun02();
    return 0;
}

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *