How to install openCv in Qt
-
I meant: use backslashes when marking a new line. For the paths themselves use forward slashes.
What error are you getting ?
-
-
opencv.cpp not found ? Where's that file coming from ?
Not knowing what your current error relates to I can't give you any recommendation.
-
The actual file itself 'openCV ' is located on my desktop... I made a file 'build' inside the folder and then 'lib' where all the files are located ; highgui etc. Is there a crucial step I missed here ? I mean I downloaded openCV installed Cmake by following a tutorial and installed this perfectly fine in Xcode.. But since moving to Qt I have not been able to get the same results.
-
There are several possibilities.
You can use pkg-config or do it like you do currently and provide the
INCLUDEPATH
andLIBS
with the adequate data.Can you share your complete .pro file ? From the bits you've given, one time you have used the wrong line ending char and the other you are complete missing it.
Example:
LIBS += \ -L/usr/local/lib \ -lopencv_core \ -lopencv_highgui INCLUDEPATH += \ /usr/local/include
You should also post the exact error you are having.
-
Yes please see bottom for code. If it at all has changed I have been modifying it and tuning it according to different tutorials to see if it'll work etc. But essentially the end result is the same ERROR: opencv.h not found' when using ' #include <opencv.h> or something similar; highgui, core ...
#-------------------------------------------------
Project created by QtCreator 2016-05-15T23:16:25
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = cam
TEMPLATE = app// new
QT += core
QT -= guiTARGET = RP_openCV_01
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += main.cpp
mainwindow.cppLIBS += -L/opt/local/lib
-lopencv_highgui.3.1.0
-lopencv_core.3.1.0INCLUDEPATH += /opt/local/include
HEADERS += mainwindow.h
FORMS += mainwindow.ui
-
Only error is the error that is indicating the header files are not found " OPENCV.H not found!'
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = cam
TEMPLATE = app// new
QT += core
QT -= guiTARGET = RP_openCV_01
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += main.cpp
mainwindow.cppLIBS += -L/opt/local/lib
-lopencv_highgui.3.1.0
-lopencv_core.3.1.0INCLUDEPATH += /opt/local/include
HEADERS += mainwindow.h
FORMS += mainwindow.ui
-
Shouldn't it be
#include <opencv2/opencv.hpp>
? -
Do you mean the opencv.h not found error ?
-
Hey, thanks for your help I actually got it and have reproduced the desired outcome... essentially what happened because I am new to Qt & OpenCV etc. It seems I have placed the code before Sources' in the project.pro file which produced the errors... I did this before as well I don't quite understand why it decides to work now but did not before? but essentially I'm good :) thanks for support
-
Good !
In that case, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)