sayze93
4th October 2012, 13:52
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[])
{
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;
}
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_c alib3d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_c ontrib240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_c ore240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_f eatures2d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_f lann240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_g pu240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_h ighgui240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_i mgproc240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_l egacy240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_m l240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_n onfree240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_o bjdetect240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_p hoto240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_s titching240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_v ideo240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_v ideostab240.dll.a"
Thanks appreciate any help to get me up and running
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[])
{
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;
}
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_c alib3d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_c ontrib240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_c ore240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_f eatures2d240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_f lann240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_g pu240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_h ighgui240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_i mgproc240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_l egacy240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_m l240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_n onfree240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_o bjdetect240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_p hoto240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_s titching240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_v ideo240.dll.a"
LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_v ideostab240.dll.a"
Thanks appreciate any help to get me up and running