Ask Your Question

Ghilas BELHADJ's profile - activity

2016-09-24 05:49:11 -0500 received badge  Famous Question (source)
2016-07-28 02:14:28 -0500 received badge  Popular Question (source)
2016-07-28 02:14:28 -0500 received badge  Notable Question (source)
2014-04-16 11:35:14 -0500 received badge  Editor (source)
2014-04-16 11:09:49 -0500 asked a question Face Recognition steps: Project Test Image

I've some issue with the understanding of the eigenface recognition steps, I've read somewhere that we must project the test image into the eigenspace, and then calculate the distance between the projected image test and the stored projection vectors.

FileStorage fs("test.xml", FileStorage::READ);
Mat stored_mean, stored_eigenvalues, stored_vectors, stored_projections, stored_labels;
int stored_num_componants = fs["num_components"];
fs["mean"] >> stored_mean;
fs["eigenvalues"] >> stored_eigenvalues;
fs["eigenvectors"] >> stored_vectors;
fs["projections"] >> stored_projections;
fs["labels"] >> stored_labels;

Mat result;
pca.project(testImageInGrayScale, result); // bugs here ...

for (int i = 0; stored_projections.rows; ++i){
    qDebug() << norm( stored_projections.row(i),weightVect );

the error code is:

OpenCV Error: Assertion failed ( && && ((mean.rows == 1 && mean.cols == data.cols) || (mean.cols == 1 && mean.rows == data.rows))) in project, file c:/opencv/sources/modules/core/src/matmul.cpp, line 3042

am I totaly wrong ? or I've just used a wrong method and the wrong types ?

2013-11-06 07:18:02 -0500 asked a question Error when linking C executable to OpenCV

I'm compiling OpenCV under Ubuntu 13.10 using cMake.

i've already compiled c++ programs and they works well.

now i'm trying to compile a C file using this cMakeLists.txt

cmake_minimum_required (VERSION 2.8)
project (hello)
find_package (OpenCV REQUIRED)
add_executable (hello src/test.c)
target_link_libraries (hello ${OpenCV_LIBS})

here is the test.c file:

#include <stdio.h>
#include <stdlib.h>
#include <opencv/highgui.h>

int main (int argc, char* argv[])
  IplImage* img = NULL; 
  const char* window_title = "Hello, OpenCV!";

  if (argc < 2)
    fprintf (stderr, "usage: %s IMAGE\n", argv[0]);
    return EXIT_FAILURE;
  img = cvLoadImage(argv[1], CV_LOAD_IMAGE_UNCHANGED);

  if (img == NULL)
    fprintf (stderr, "couldn't open image file: %s\n", argv[1]);
    return EXIT_FAILURE;
  cvNamedWindow (window_title, CV_WINDOW_AUTOSIZE);
  cvShowImage (window_title, img);

  return EXIT_SUCCESS;

it returns me this error whene running cmake . then make to the project:

Linking C executable hello
/usr/bin/ld: CMakeFiles/hello.dir/src/test.c.o: undefined reference to symbol «lrint@@GLIBC_2.1»
/lib/i386-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [hello] Erreur 1
make[1]: *** [CMakeFiles/hello.dir/all] Erreur 2
make: *** [all] Erreur 2
2013-09-29 05:20:29 -0500 received badge  Autobiographer