Ask Your Question

varunIITD's profile - activity

2017-09-22 07:15:38 -0600 received badge  Popular Question (source)
2014-03-21 02:05:23 -0600 received badge  Editor (source)
2014-03-21 02:02:56 -0600 asked a question Face recognition verification using fisherfaces algorithm

I am working on Face recognition as a part of my project. I am using the fisherfaces program provided in OpenCV website for the same. But the program code provided there does not have verification and the recognition always results in a subject in the database even though it is a false subject. The fisherfaces reconstruction does not perform well. The Similarity error for both the true test inputs (true test input - picked from the database) and false test inputs (false test input - NOT picked from the database) are quite close to each other and some even overlap with the range of values from true test inputs.

I performed an experiment on AT & T database which has 40 subjects.

I selected 20 out of them for database and rest 20 i used to provide false test input where the ideal behavior of false test input is not to get recognized to one of the images in database. But the normalized euclidean distance of the false test inputs are quite near and some even overlap with the normalized euclidean distance of the true test inputs. Please let me know if there is any method to set an appropriate threshold and hence make the algorithm work well.

Results for false_test_inputs

Identity: 0. Similarity error: 0.357048 Identity: 0. Similarity error: 0.364141 Identity: 0. Similarity error: 0.368228 Identity: 0. Similarity error: 0.322856 Identity: 0. Similarity error: 0.298744 Identity: 0. Similarity error: 0.3978 Identity: 0. Similarity error: 0.354158 Identity: 8. Similarity error: 0.417423 Identity: 0. Similarity error: 0.42364

Results for true_test_inputs

Identity: 8. Similarity error: 0.291803 Identity: 8. Similarity error: 0.381701 Identity: 8. Similarity error: 0.455005 Identity: 8. Similarity error: 0.378799 Identity: 8. Similarity error: 0.480244 Identity: 8. Similarity error: 0.456196 Identity: 8. Similarity error: 0.419657 Identity: 8. Similarity error: 0.361412

I can mail the complete list if in case it is needed. I am not posting the similarity errors of all 100 true and false test samples as it will not be clear in viewing them in the forum.

I can attach a plot of the samples.At_T.png

2013-10-30 14:19:42 -0600 commented answer Static linking of OpenCV libraries in linux32

A lot of them include pthreads, gtk etc..

2013-10-30 14:17:38 -0600 commented answer Static linking of OpenCV libraries in linux32

Actually i need to create static executable. But g++ --static followed by format mentioned by you does not work :( It throws many errors approx 500! Can you help in this matter berak?

2013-10-30 04:33:33 -0600 asked a question Problem in cvGet2D function

//Program to use an image having 4 characters(eg : Z,L,5,T) of size 128x128 and store its pixel //values in a 1D array input_data

include "opencv2/core/core_c.h"

include "opencv2/highgui/highgui_c.h"

include <stdio.h>

include <stdlib.h>

define size 128

define neurons 16384

int input_data[4*neurons];

int main( int argc, const char** argv )


unsigned char pixels_array[size][size];
int height,total_width,per_image_width,i,counter=0,image_count=0,u,v;
FILE *fp;
IplImage* image;
CvScalar s;
char input_image[16];

printf("\nEnter the name of image\n");  

//input image is 512x128 i.e 4 characters of 128x128 arranged horizontally

image = cvLoadImage(input_image,CV_LOAD_IMAGE_GRAYSCALE);

    printf("Cannot read image file");
    return -1;

// get the image data

height    = image->height;
total_width = image->width;
printf("Processing a %dx%d image\n",height,total_width); 

image_count = total_width / size ; //gives the number of characters in image strip
per_image_width = total_width / image_count; //this is definitely 128
printf("\nNo of images in plate : %d, Per image width : %d\n",image_count,per_image_width);

fp = fopen("actual.txt","w");

    counter = per_image_width * i;  
          for(v= counter ; (v < (counter + per_image_width)) && (v < total_width) ; v+=1)
                    //this is how I am extracting pixel values   s=cvGet2D(image,u,v);                                                  pixels_array[u][v]=s.val[0];

            if (pixels_array[u][v]>127)
                input_data[(neurons*i)+ u*height + v] = 1 ;
                input_data[(neurons*i)+u*height +v] = -1;   
    fprintf(fp,"\[email protected]@@@@@@@@@@This is the end of image number %[email protected]@@@@@@@@@@@\n",i);
return 0;


When i see the resultant matrix in a file, i can see the first character clearly. But the second character does not print completely. It fails in its last iteration ie i=1, u=127, v=161 The error thrown is as follows:

OpenCV Error: Bad argument (unrecognized or unsupported array type) in cvPtr2D, file /home/varun/MTP1/opencv-, line 1830 terminate called after throwing an instance of 'cv::Exception' what(): /home/varun/MTP1/opencv- error: (-5) unrecognized or unsupported array type in function cvPtr2D

Aborted (core dumped)

I checked in array.cpp of OpenCV/modules/core/src directory containing cvGet2D but did not understand completely. Can somebody tell what the problem is? Thanks.

2013-10-27 01:09:43 -0600 commented answer Static linking of OpenCV libraries in linux32

ok i will check with that and let u know. Thanks for your help.

2013-10-26 03:07:12 -0600 commented answer Static linking of OpenCV libraries in linux32

Thanks buddy !

2013-10-25 15:51:00 -0600 commented answer Static linking of OpenCV libraries in linux32

Thanks berak :) I found that these static libraries(.a files) are generated in /usr/local/lib. Can you let me know how to link these static libraries in g++? Earlier, my command was the following: g++ facerec_save_load_eigen.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_objdetect -lopencv_contrib -o faceRec What is the change that i need to do now?

Thanks a ton for timely and much needed response.

2013-10-25 00:42:33 -0600 asked a question Static linking of OpenCV libraries in linux32

I am using OpenCV for my project.

I am using eigen faces for face recognition. While compiling the program i use opencv_core, opencv_imgproc, opencv_highgui, opencv_objdetect, opencv_contrib libraries and i link them dynamically prefixing "-l" to each library. But my application needs to create a static executable file whi ch contains all the above libraries.

I found that we can statically link using archives. But i need ".o" files of all libraries to put in archive and then statically link. How can i create .o files of libraries. Presently i have only .so files in /usr/local/lib. Please help me in this matter.