Problem qith OpenCV and Qt creator
-
i have a problem I just downloaded the qt and also I want to use the opencv but I can't because it says
#-------------------------------------------------Project created by QtCreator 2014-04-02T02:57:55
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = JanelaOpenCv
TEMPLATE = app
LIBS += -lopencv_core
-lopencv_highgui
SOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
it says that they cannot find the libraries I do not know how to kink them or how to start working with it thanks -
If OpenCV is not installed in a known path, you need to tell Qt where to find it.
Add
@LIBS += -L/path/to/OpenCV/libraries@To your pro file
-
ok fine i did this
#-------------------------------------------------Project created by QtCreator 2014-04-02T13:24:58
#-------------------------------------------------
QT += core
QT -= gui
TARGET = Consola
CONFIG += console
CONFIG -= app_bundle
LIBS += -L/path/to/OpenCV/libraries
TEMPLATE = appSOURCES += main.cp
i have my openCv in the following path so how do i have to do set it to start using it
the path is the following
E:\Open Cv\opencv\build\x86\vc12\lib
so please help me how to do it i am new on it -
@LIBS += -LE:/OpenCV/opencv/build/x86/vc12/lib@
Forward slashes and avoid spaces in the path, it's known to be problematic
-
Oh ok thanks for the help so it runs now very well so it means that all the libraries in the folder can be used right??
-
Yes it is right
-
i am trying to do run my code in this way
//objectTrackingTutorial.cpp//Written by Kyle Hounslow 2013
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")
//, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
//and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions://The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
//IN THE SOFTWARE.#include <sstream>
#include <string>
#include <iostream>
#include <opencv\highgui.h>
#include <opencv\cv.h>using namespace cv;
//initial min and max HSV filter values.
//these will be changed using trackbars
int H_MIN = 0;
int H_MAX = 256;
int S_MIN = 0;
int S_MAX = 256;
int V_MIN = 0;
int V_MAX = 256;but it says
E:\QT\Qt Projects\Project 2\Consola\Project_image\main.cpp:19: error: opencv\highgui.h: No such file or directory
#include <opencv\highgui.h>
^E:\QT\Qt Projects\Project 2\Consola\Project image\main.cpp
so please how can i solve it
-
Add the path of OpenCV's include.
Something like:@INCLUDEPATH += E:/OpenCV/opencv/include@
-
i just did it but ok i have this code
QT += core guigreaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Project_image
TEMPLATE = app
INCLUDEPATH += E:/OpenCV/opencv/include
LIBS += -LE:/OpenCV/opencv/build/x86/vc12/lib
SOURCES += main.cpp
mainwindow.cpp
../../../project 1/objectTrackingTut.cpp
../../../project 1/objectTrackingTut.cpp
../../../project 1/objectTrackingTut.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
and in the main i have
#include <sstream>
#include <string>
#include <iostream>
#include <opencv\highgui.h>
#include <opencv\cv.h>using namespace cv;
//initial min and max HSV filter values.
//these will be changed using trackbars
int H_MIN = 0;
int H_MAX = 256;
int S_MIN = 0;
int S_MAX = 256;
int V_MIN = 0;
int V_MAX = 256;
//default capture width and height
const int FRAME_WIDTH = 640;
const int FRAME_HEIGHT = 480;
//max number of objects to be detected in frame
const int MAX_NUM_OBJECTS=50;
//minimum and maximum object area
const int MIN_OBJECT_AREA = 2020;
const int MAX_OBJECT_AREA = FRAME_HEIGHTFRAME_WIDTH/1.5;
//names that will appear at the top of each window
const string windowName = "Original Image";
const string windowName1 = "HSV Image";
const string windowName2 = "Thresholded Image";
const string windowName3 = "After Morphological Operations";
const string trackbarWindowName = "Trackbars";
void on_trackbar( int, void* )
{//This function gets called whenever a
// trackbar position is changedand i still have problems it says
#include <opencv\highgui.h> not such a file or directory i do not know why
-
Look at the Projects panel, you have the "Build directory" path there