So I installed openCV and wanted to make a very basic program with Qt, when I compiled and ran the program it would return a command line window with the message "press <return> to close" and the Qt output panel printed "...exe exited with code 0" ??
I know that it means there were no errors and everything was successful but why didnt it execute the actual code which is suppose to get the cameras video and display it in a new window.
Btw here is my code:
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <QtCore>
int main(int argc, char *argv[])
{
cv::VideoCapture cam = cv::VideoCapture(0);
cv::Mat frame;
cv::namedWindow ("Demo", CV_WINDOW_AUTOSIZE);
while (1) {
cam >> frame;
imshow ("Demo", frame);
}
cam.release();
return 0;
}
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <QtCore>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
cv::VideoCapture cam = cv::VideoCapture(0);
cv::Mat frame;
cv::namedWindow ("Demo", CV_WINDOW_AUTOSIZE);
while (1) {
cam >> frame;
imshow ("Demo", frame);
}
cam.release();
return 0;
}
To copy to clipboard, switch view to plain text mode
And here is my .pro file if it matters:
QT += core
QT -= gui
TARGET = WebCam
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += "C:\openCV24\opencv_bin\install\include"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_calib3d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_contrib240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_core240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_features2d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_flann240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_gpu240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_highgui240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_imgproc240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_legacy240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_ml240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_nonfree240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_objdetect240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_photo240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_stitching240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_video240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_videostab240.dll.a"
QT += core
QT -= gui
TARGET = WebCam
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += "C:\openCV24\opencv_bin\install\include"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_calib3d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_contrib240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_core240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_features2d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_flann240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_gpu240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_highgui240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_imgproc240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_legacy240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_ml240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_nonfree240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_objdetect240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_photo240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_stitching240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_video240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_videostab240.dll.a"
To copy to clipboard, switch view to plain text mode
Thanks appreciate any help to get me up and running
Bookmarks