[Moved] "exited with code 0" error
-
@#include <QtCore/QCoreApplication>
#include <stdio.h>
#include <cv.h>
#include <highgui.h>
#include <highgui.hpp>
#include <cvaux.h>
#include <cvwimage.h>
#include <cv.hpp>tCvHaarClassifierCascade *cascade;
CvMemStorage *storage;void detectFaces(IplImage *img);
int main(int argc,char**argv)
{
CvCapture *capture;
IplImage *frame;
int key;
char *filename="C:\opencv\opencv\data\haarcascades\haarcascade_frontalface_alt.xml";cascade=(CvHaarClassifierCascade*)cvLoad(filename,0,0,0); storage=cvCreateMemStorage(0); capture=cvCaptureFromCAM(0); assert(cascade&&sorage&&capture); cvNamedWindow("video",1); while(key!='q') { frame=cvQueryFrame(capture); if(!frame) break; cvFlip(frame,frame,-1); frame->origin=0; detectFaces(frame); key=cvWaitKey(10); } cvReleaseCapture(&capture); cvDestroyWindow("video"); cvReleaseHaarClassifierCascade(&cascade); cvReleaseMemStorage(&storage); return 0;
}
void detectFaces(IplImage *img)
{
int i;
CvSeq *faces=cvHaarDetectObjects(img,cascade,storage,1.1,3,0,cvSize(40,40));for(i=0;i<(faces?faces->total:0);i++) { CvRect *r=(CvRect*)cvGetSeqElem(faces,i); cvRectangle(img,cvPoint(r->x,r->y),cvPoint(r->x+r->width,r->y+r->height),CV_RGB(255,0,0),1,8,0); } cvShowImage("video",img);
}
@
---this is my .cpp file.
-
Thank you so much.
I am using OQ creator and this project is console app. I am sending my .pro file.
@#-------------------------------------------------Project created by QtCreator 2011-12-12T12:18:39
#-------------------------------------------------
QT += core
QT -= gui
TARGET = calisma1
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH +=C:/opencvbuild/install/include/opencv
INCLUDEPATH +=C:/opencvbuild/install/include/opencv2/highgui
INCLUDEPATH +=C:/opencvbuild/install/includeLIBS += C:/opencvbuild/install/bin/*.dll
HEADERS +=
main.h@
-
Frankly, i don't know much about openCV. Anyway, exited with 0 is the result of @ return 0;@ in your main(). And That means ,successful completion of the execution.
And what does Qt do in your application ?
EDIT : Just noticed : in your pro file, @LIBS += C:/opencvbuild/install/bin/*.dll@ I am bit doubtful about this part. I am not sure,wildcard can be used in here.
-
yes, i know its a console application. But this is not really a Qt application right? i mean,Not a Qt-console application. I couldn't find usage of Qt APIs anywhere in codes
[quote author="kuheylan" date="1323711448"]in console application! ...[/quote]
-
Please kuheylan, calm down a bit. Don't flag your message as urgent, even if it is for you. It is hard for people to guess what is going wrong in your code, especially if they don't see it.
Your code does not look like real Qt code to me. Normally, Qt code creates a Q(Core)Application, calls exec() on that, and only exits when the eventloop is terminated. You are just creating a loop of your own, and I fail to see the connection between Qt and your code. Your code doesn't use a single Qt class. Perhaps you should ask your question in an OpenCV channel?
-
[quote author="kuheylan" date="1323711840"]But my friend used this code in qt and he says that it runs and camera runs. you are right it is not really a qt app. I found it[/quote]
So... It is not even your code, but something you found off the net and your friend states works, and now you expect us to support it and help you figure out what it is doing? Sorry, it doesn't work like that. Please do your own homework.