Ask Your Question

lovelf's profile - activity

2014-08-29 01:31:21 -0500 received badge  Student (source)
2013-09-22 07:43:59 -0500 commented answer Trying to use face recognition, the facerecognizer

ok, awesome, I am still getting expecting constructor, destructor or type conversion before < and before . , etc, as on the code output of the question, thanks so much really, I would love to implement face recognizer on my website

2013-09-14 09:36:33 -0500 asked a question Trying to use face recognition, the facerecognizer

So I copied from

 // Let's say we want to keep 10 Eigenfaces and have a threshold value of 10.0
 int num_components = 10;
 double threshold = 10.0;
 // Then if you want to have a cv::FaceRecognizer with a confidence threshold,
 // create the concrete implementation with the appropiate parameters:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer(num_components, threshold);

 // The following line reads the threshold from the Eigenfaces model:
 double current_threshold = model->getDouble("threshold");
 // And this line sets the threshold to 0.0:
 model->set("threshold", 0.0);

 // Create a FaceRecognizer:
 Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
 // And here's how to get its name:
 String name = model->name();

 // holds images and labels
 vector<Mat> images;
 vector<int> labels;
 // images for first person
 images.push_back(imread("/var/www/html/photos/1.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/2.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/3.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/4.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/5.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/6.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/7.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/8.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/9.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/10.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/11.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/12.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/13.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/14.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/15.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/16.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/17.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/19.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/20.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/21.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/22.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/23.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/24.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/25.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/26.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/27.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/28.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/29.jpg", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
 images.push_back(imread("/var/www/html/photos/30 ...
2013-03-06 13:55:48 -0500 asked a question apache not being able to load opencv library

$myexec="/var/www/html/facedetect/facedetect myimage.jpg" exec($myexec." 2>&1");


"/var/www/html/facedetect/facedetect: error while loading shared libraries: cannot open shared object file: No such file or directory"

I think this must have to do with user apache not being able to read a source to get through to that library, what would be the approach for apache to be able to get to that library.

Or most likely in which file could I change to an absolute path

so that it loads form /usr/local/lib/

anyways this might just pop another error for another library, besides I don't know how to appropriately let apache be the owner of that file if that's necessary at all, would check once this gets solved.

2013-03-06 11:40:27 -0500 asked a question Unsupported format or combination of formats () in cvGetQuadrangle

Unsupported format or combination of formats () in cvGetQuadrangle

with a .png file, it works with a .jpg file though, what could be the cause?

OpenCV Error: Unsupported format or combination of formats () in cvGetQuadrangle                         SubPix, file /root/OpenCV-2.4.4/modules/imgproc/src/samplers.cpp, line 819
terminate called after throwing an instance of 'cv::Exception'
what():  /root/OpenCV-2.4.4/modules/imgproc/src/samplers.cpp:819: error: (-210                    )  in function cvGetQuadrangleSubPix
2013-03-06 01:18:59 -0500 asked a question It always return faces->total = 0 for any photo - issue with cvaux.h

Using the below code I have to detect the faces of a photo and print the rectangle's coordinates and sizes, along the total count of rectangles plus draw these rectangles and save the image with the rectangles drawn.

Yet I always get faces->total = to 0, one problem could be that actually when compiling cvaux.h inclussion pops up a list of errors. Is cvaux.h necessary for this to work ? it seems to execute although the return of faces->total is 0. If cvaux.h is the cause of the problem here are the errors listed when I try to compile facedetectv.c as rancho:

[root@ip-xxx html]# gcc `pkg-config --cflags --libs opencv` -o rancho facedetectv.c
In file included from /usr/local/include/opencv/cvaux.h:54,
                 from facedetectv.c:4:
/usr/local/include/opencv2/video/background_segm.hpp:47:16: error: list: No such file or directory
In file included from /usr/local/include/opencv/cvaux.h:54,
                 from facedetectv.c:4:
/usr/local/include/opencv2/video/background_segm.hpp:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cv'
In file included from /usr/local/include/opencv/cvaux.h:60,
                 from facedetectv.c:4:
/usr/local/include/opencv2/legacy/blobtrack.hpp:82: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvVSModule'
/usr/local/include/opencv2/legacy/blobtrack.hpp:133: error: expected ';', ',' or ')' before '=' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:137: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvFGDetector'
/usr/local/include/opencv2/legacy/blobtrack.hpp:148: error: expected ')' before '*' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:149: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:160: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cvBlob'
In file included from /usr/local/include/opencv/cvaux.h:60,
                 from facedetectv.c:4:
/usr/local/include/opencv2/legacy/blobtrack.hpp:180: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvBlobSeq'
/usr/local/include/opencv2/legacy/blobtrack.hpp:270: error: expected specifier-qualifier-list before 'CvBlobSeq'
/usr/local/include/opencv2/legacy/blobtrack.hpp:273: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvBlobTrackSeq'
/usr/local/include/opencv2/legacy/blobtrack.hpp:294: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvBlobDetector'
/usr/local/include/opencv2/legacy/blobtrack.hpp:308: error: expected ')' before '*' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:311: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:312: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:314: error: expected identifier or '(' before ':' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:319: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cvDetectedBlob'
/usr/local/include/opencv2/legacy/blobtrack.hpp:327: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvObjectDetector'
/usr/local/include/opencv2/legacy/blobtrack.hpp:391: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvImageDrawer'
/usr/local/include/opencv2/legacy/blobtrack.hpp:410: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CvBlobTrackGen'
/usr/local/include/opencv2/legacy/blobtrack.hpp:420: error: expected ')' before '*' token
/usr/local/include/opencv2/legacy/blobtrack.hpp:427: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/include/opencv2 ...
2013-03-05 05:44:36 -0500 asked a question Trying to detect faces in linux, done it in windows

I am trying to detect faces in still photos. I am using the following which gets to compile, using Open CV 2.2.0 installed from a rpm for Cent OS.

What I get is

Failed to initialize libdc1394 Segmentation fault

I read that libdc1394 has to do with it not initializing the camera or something similar and that it can be ignored, this is holding in a server therefore it won't initialize the server's camera.

But segmentation fault does not allow me to execute the code like it should. Right now the code below doesn't print in a way that php can access it, I have that functioning with C++ for Windows but it's been running on a project on localhost for sometime now and I want to host it online but for that I need to have opencv working with Linux.

Segmentation fault could come from any "stupid" error the below code might have but I'm just not very much proficient with c or c++.


#include <stdio.h>
 #include "cv.h"
 #include "highgui.h"
 #include "cvaux.h"
 CvHaarClassifierCascade *cascade;
 CvMemStorage            *storage;
 char *face_cascade="/usr/include/opencv/haarcascade_frontalface_default.xml";

 void detectFacialFeatures( IplImage *img,IplImage *temp_img)
 char image[100],msg[100],temp_image[100];
 float m[6];
 double factor = 1;
 CvMat M = cvMat( 2, 3, CV_32F, m );
 int w = (img)->width;
 int h = (img)->height;
 CvSeq* faces;
 CvRect *r;
 m[0] = (float)(factor*cos(0.0));
 m[1] = (float)(factor*sin(0.0));
 m[2] = w*0.5f;
 m[3] = -m[1];
 m[4] = m[0];
 m[5] = h*0.5f;
 cvGetQuadrangleSubPix(img, temp_img, &M);
 CvMemStorage* storage=cvCreateMemStorage(0);
 cvClearMemStorage( storage );
 if( cascade )
 faces = cvHaarDetectObjects(img,cascade, storage, 1.2, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(20, 20));
 printf("\nFrontal face cascade not loaded\n");
 printf("\n no of faces detected are %d",faces->total);
 int i=0;
 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 );    
 printf("\n face_x=%d face_y=%d wd=%d ht=%d",r->x,r->y,r->width,r->height);
 cvSaveImage( image, img ,0);

 int main( int argc, char *argv[])
 char *dea;
 char *image;

 IplImage  *img,*temp_img;
 int       key;
 storage = cvCreateMemStorage( 0 );
 cascade = ( CvHaarClassifierCascade* )cvLoad( face_cascade, 0, 0, 0 );
 if( !(cascade) )
 fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
 return -1;
 printf("Could not load image file and trying once again: %s\n",image);
 printf("\n curr_image = %s",image);
 cvReleaseHaarClassifierCascade( &cascade );
 cvReleaseMemStorage( &storage );
 return 0;

the segmentation fault comes in this line:

faces = cvHaarDetectObjects(img,cascade, storage, 1.2, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(20, 20));
2013-03-04 09:52:44 -0500 commented answer command not found linux opencv

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

2013-03-04 08:46:55 -0500 commented answer command not found linux opencv

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

2013-03-04 08:45:12 -0500 received badge  Editor (source)
2013-03-04 07:44:09 -0500 asked a question command not found linux opencv

CvHaarClassifierCascade command not found

trying to execute

 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
 {CvRect *r=(CvRect *)cvGetSeqElem(faces,i);
 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);

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)'