// you’re reading...

C / C++ / Objective-C

Getting OpenCV setup on Fedora Linux with QT

Funny thing I’ve found about Linux distros and software applications… settings are meant to be paid attention to and tweaked. There are no common folder layouts that one should really count on. Maybe /bin or /usr/bin. But anyway, getting a QT project setup to utilize OpenCV libs was interesting. Here’s what I did:

1. Install OpenCV with yum:

yum install opencv opencv-devel

2. Setup a QT console application, then in the project file, add these lines:

INCLUDEPATH += /usr/include/opencv
INCLUDEPATH += /usr/include/opencv2
LIBS += -L/usr/lib -lopencv_core -lopencv_highgui

3. My main.cpp file looks like this:

#include <cstdlib>                  // EXIT_SUCCESS
#include <iostream>                 // cout, cerr
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char *argv[])
{
// QCoreApplication a(argc, argv);
cv::Mat image = cv::imread("/path/to/file.png");
cv::namedWindow("TestWindow1");
cv::imshow("TestWindow1", image);
cv::waitKey(5000);
//return a.exec();
return EXIT_SUCCESS;
}

The result:
opencv qt test

Discussion

3 comments for “Getting OpenCV setup on Fedora Linux with QT”

  1. I love you so much.
    Thanks for this.

    Posted by Koopa | June 29, 2014, 9:02 am
  2. […] @randymelder | Getting OpenCV setup on Fedora Linux with QT […]

    Posted by @randymelder | Getting OpenCV setup on Fedora Linux with QT – Blog Badwi | December 23, 2015, 8:12 pm
  3. Thank you for posting this tutorial.
    It is my first step to learn OpenCV in Fedora.

    Posted by badwi | December 23, 2015, 8:17 pm

Post a comment

Help support my site and buy a domain name at http://domainsemailhosting.com/

%d bloggers like this: