Ask Your Question
1

command not found linux opencv

asked Mar 4 '13

lovelf gravatar image

updated Mar 4 '13

CvHaarClassifierCascade command not found

trying to execute

#include<stdio.h>
 #include<cv.h>
 #include<highgui.h>
 CvHaarClassifierCascade *cascade;
 CvMemStorage *Membuffer;
 void detectfaces(IplImage *frame)
 {
 int i;
 CvSeq *faces=cvHaarDetectObjects(frame,cascade,Membuffer,1.1,3,0,cvSize(30,30));//Maximum 3 neighbourhood images and the last cvsize gives minimum size of face
 for(i=0;i<(faces?faces->total:0);i++)
 {CvRect *r=(CvRect *)cvGetSeqElem(faces,i);
 cvRectangle(frame,cvPoint(r->x,r->y),cvPoint(r->x+r->width,r->y+r->height),CV_RGB(255,0,0),1,8,0);
 }
 }
 int main(int argc,char *argv[])
 {IplImage *frame;
 CvCapture *capture;
 int key;
 char filename[]="haarcascade_frontalface_alt.xml";
 cascade=(CvHaarClassifierCascade *)cvLoad(filename,0,0,0);
 Membuffer=cvCreateMemStorage(0);
 while(key!='q')
 {frame=cvQueryFrame(capture);
 if(!frame)
 break;
 frame->origin=0;
 detectfaces(frame);
 key=cvWaitKey(10);
 }
 cvReleaseCapture(&capture);
 cvDestroyWindow("Video");
 cvReleaseHaarClassifierCascade(&cascade);
 cvReleaseMemStorage(&Membuffer);
 }

also trying to execute installation samples from fodler c

other command not found errors pop up in putty ssh

What can I do, where might the problem be at?

 [root@ip-xxx c]# ./facedetect.c
 ./facedetect.c: line 5: CvHaarClassifierCascade: command not found
 ./facedetect.c: line 6: CvMemStorage: command not found
 ./facedetect.c: line 8: syntax error near unexpected token `('
 ./facedetect.c: line 8: `void detectfaces(IplImage *frame)'

Thanks

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Mar 4 '13

berak gravatar image

updated Mar 4 '13

it's probably missing

#include<ml.h>

#include <opencv2/objdetect/objdetect.hpp> // CvHaarClassifierCascade is here

Preview: (hide)

Comments

added it to the facedetect.c file but still get the same errors, posted the exact output from ssh

lovelf gravatar imagelovelf (Mar 4 '13)edit

btw, putty ? you're remote debugging/programming ? you might need another idea of stopping the program than 'someone presssed q' ;)

berak gravatar imageberak (Mar 4 '13)edit

also, you never initialize the capture ...

berak gravatar imageberak (Mar 4 '13)edit

right, I just think the problem might be related to missing dependencies for opencv in CentOS, it's harder to find information for it that's related to installing OpenCV

lovelf gravatar imagelovelf (Mar 4 '13)edit

Question Tools

Stats

Asked: Mar 4 '13

Seen: 941 times

Last updated: Mar 04 '13