Face detection program bug

 
0
 

Hi guys, I'm currently trying to produce a facial detection application, but I seem to have some problems. My program, is able to recognise multiple users, and match their captured image to one saved in the database. However, if a person who has not registered is photographed, it is supposed open a pop-up of a picture of my choosing (in the code below I've chosen a picture of Mario) and tell the user that he/she is not in the database. The code for the condition of both recognizing and showing an unrecognised user is below.

The problem I have, is that when an unrecognised user is captured, it will still show user 1 or 2, instead of a "Mario" image. I'm unsure if it is the recognition algorithm (code also below) or my "if" statement that is at fault. I'm now trying with only 2 users to minimize the chance of errors. Can anyone help?

void CzebraDlg::OnBnClickedCapturetrain()
{
else if( LearnOrRecognize == 2)  // CASE 2 (CAPTURE FOR RECOGNIZE)
{
    sprintf(PicFname, "%s", "test.jpg");
    sprintf(TestFname, "%s", "test.txt");

    ofstream outfile;   //An object:myfile of type "ofstream" is created to allow the file to be opened for writing
    outfile.open(TestFname, ios::app);

    char *temp  = new char[50];

    sprintf(temp, "%s", "1 test.jpg");
    outfile << temp <<endl;

    cvSaveImage(PicFname, gregion);

    recognize();

    IplImage* Identified_Person_Img;

    if (RESULT_NEAREST == 1) //Nearest refers to ID of person being recognized
    {
        cvNamedWindow( "ID01", 0 );
        cvResizeWindow( "ID01", 160, 160 );
        cvMoveWindow( "ID01", 673, 506 );
        Identified_Person_Img = cvLoadImage( "D:\\FYP\\01\\1.jpg", 1 );
        cvShowImage("ID01", Identified_Person_Img);
        EEE(node_number=0); //meant for hardware interfacing, not used
    }
    if (RESULT_NEAREST !=1)
    {
        if (RESULT_NEAREST == 2)
        {
            cvNamedWindow( "ID02", 0 );
            cvResizeWindow( "ID02", 160, 160 );
            cvMoveWindow( "ID02", 673, 506 );
            Identified_Person_Img = cvLoadImage( "D:\\FYP\\02\\1.jpg", 1 );
            cvShowImage("ID02", Identified_Person_Img);
            EEE(node_number=1);
        }
    }
    if (!(RESULT_NEAREST == 1) && !(RESULT_NEAREST == 2))
    {
        cvNamedWindow( "Unknown Face Detected", 0 );
        cvResizeWindow( "Unknown Face Detected", 160, 160 );
        cvMoveWindow( "Unknown Face Detected", 673, 506 );
        IplImage* UnknownFace;
        UnknownFace = cvLoadImage( "D:\\FYP\\MARIO1.jpg", 1 );
        IplImage *FUnknownFace = 0;
        FUnknownFace = cvCreateImage(cvSize(160, 160),            
            UnknownFace->depth, UnknownFace->nChannels);
        cvResize( UnknownFace, FUnknownFace, CV_INTER_LINEAR );
        cvShowImage("Unknown Face Detected", FUnknownFace);
        EEE(node_number=20);
    }
    outfile.close();
}
}

Recognition function is below for reference and error checking.

void recognize()
{
	int i, nTestFaces  = 0;         // the number of test images
	CvMat * trainPersonNumMat = 0;  // the person numbers during training
	float * projectedTestFace = 0;

	// load test images and ground truth for person number
	nTestFaces = loadFaceImgArray("test.txt");

	// load the saved training data
	if( !loadTrainingData( &trainPersonNumMat ) ) return;

	// project the test images onto the PCA subspace
	projectedTestFace = (float *)cvAlloc( nEigens*sizeof(float) );

	int iNearest, nearest, truth;

	for(i=0; i<nTestFaces; i++)
	{
		// project the test image onto the PCA subspace
		cvEigenDecomposite
			(
				faceImgArr[i],
				nEigens,
				eigenVectArr,
				0, 0,
				pAvgTrainImg,
				projectedTestFace);

		iNearest = findNearestNeighbor(projectedTestFace);
		truth    = personNumTruthMat->data.i[i];
		nearest  = trainPersonNumMat->data.i[iNearest];
		
		}
        RESULT_NEAREST = nearest;
		RESULT_TRUTH   = truth;
}

Function that gives values to the one above's code is below

int findNearestNeighbor(float * projectedTestFace)
{
	double leastDistSq = DBL_MAX;
	int i, iTrain, iNearest = 0;

	for(iTrain=0; iTrain<nTrainFaces; iTrain++)
	{
		double distSq=0;

		for(i=0; i<nEigens; i++)
		{
			float d_i =
				projectedTestFace[i] -
				projectedTrainFaceMat->data.fl[iTrain*nEigens + i];
			distSq += d_i*d_i / eigenValMat->data.fl[i];
			
		}

		if(distSq < leastDistSq)
		{
			leastDistSq = distSq;
			iNearest = iTrain;
		}
	}

	return iNearest;
}

I'm using MFC for the GUI creation, but I don't think that should be a problem as of now. Thanks a lot for any help in advance. If you need to see the entire .cpp file that these snippets came from, I have attached it as well.

Attachments zebraDlg.cpp (50.35 KB)
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
// zebraDlg.cpp : implementation file
//
#include "stdafx.h"
#include "zebra.h"
#include "zebraDlg.h"
#include <string>
#include <fstream>
#include "windows.h"
#include <iomanip>
#include <cstdio>
#include <cstdlib>

#include "bliondi.h" //self defined header

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

//Class for instructions dialog

class CInstructionsDlg : public CDialog
{
public:
	CInstructionsDlg() :CDialog(IDD) {} //*******Updated constructor

// Dialog Data
	enum { IDD = IDD_Instructions };

	//protected: //*** Leave this out for time being
	//virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation //** Leave this out for time being
//protected:
	//DECLARE_MESSAGE_MAP()
};


// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg() :CDialog(IDD) {} //*******Updated constructor

// Dialog Data
	enum { IDD = IDD_About };

	//protected: //*** Leave this out for time being
	//virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation //** Leave this out for time being
//protected:
	//DECLARE_MESSAGE_MAP()
};



//BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//END_MESSAGE_MAP()


// CzebraDlg dialog




CzebraDlg::CzebraDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CzebraDlg::IDD, pParent)
	, m_HSLIDER1(_T(""))
	, m_HSLIDER2(_T(""))
	, m_HSLIDER3(_T(""))
	, m_Display(_T(""))
	, m_CHOICE(FALSE)
	, m_echo(_T(""))
	, m_PersonId(FALSE)
	, m_DetectedName(_T(""))
	, m_NameVal(_T(""))
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CzebraDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//DDX_Text(pDX, IDC_HSLIDER1, m_HSLIDER1);
	//DDX_Text(pDX, IDC_HSLIDER2, m_HSLIDER2);
	//DDX_Text(pDX, IDC_HSLIDER3, m_HSLIDER3);
	//DDX_Control(pDX, IDC_H_SLIDER_BAR1, m_HSLIDERBAR1);
	//DDX_Control(pDX, IDC_H_SLIDER_BAR2, m_HSLIDERBAR2);
	//DDX_Control(pDX, IDC_H_SLIDER_BAR3, m_HSLIDERBAR3);

	//DDX_Text(pDX, IDC_DISPLAY, m_Display);
	DDX_Radio(pDX, IDC_LEARN, m_CHOICE);
	DDX_Text(pDX, IDC_ECHO, m_echo);
	DDX_Radio(pDX, IDC_A, m_PersonId);
	DDX_Text(pDX, IDC_NameOfDetectFace, m_DetectedName);
	DDX_Control(pDX, IDC_Name, m_NameCtl);
	DDX_Text(pDX, IDC_Name, m_NameVal);
	DDX_Control(pDX, IDC_Box01, m_Box01Ctl);
	DDX_Control(pDX, IDC_Box02, m_Box02Ctl);
	DDX_Control(pDX, IDC_Box03, m_Box03Ctl);
	DDX_Control(pDX, IDC_Box04, m_Box04Ctl);
	DDX_Control(pDX, IDC_Box05, m_Box05Ctl);
	DDX_Control(pDX, IDC_Box06, m_Box06Ctl);
	DDX_Control(pDX, IDC_Box07, m_Box07Ctl);
	DDX_Control(pDX, IDC_Box08, m_Box08Ctl);
	DDX_Control(pDX, IDC_Box09, m_Box09Ctl);
	DDX_Control(pDX, IDC_Box10, m_Box10Ctl);
	DDX_Control(pDX, IDC_Box11, m_Box11Ctl);
	DDX_Control(pDX, IDC_Box12, m_Box12Ctl);
	DDX_Control(pDX, IDC_Box13, m_Box13Ctl);
	DDX_Control(pDX, IDC_Box14, m_Box14Ctl);
	DDX_Control(pDX, IDC_Box15, m_Box15Ctl);
	DDX_Control(pDX, IDC_Box16, m_Box16Ctl);
	DDX_Control(pDX, IDC_Box17, m_Box17Ctl);
	DDX_Control(pDX, IDC_Box18, m_Box18Ctl);
	DDX_Control(pDX, IDC_Box19, m_Box19Ctl);
	DDX_Control(pDX, IDC_Box20, m_Box20Ctl);
}

BEGIN_MESSAGE_MAP(CzebraDlg, CDialog)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDC_CAMERA, &CzebraDlg::OnBnClickedCamera)
	ON_BN_CLICKED(IDCANCEL, &CzebraDlg::OnBnClickedCancel)
	//ON_STN_CLICKED(IDC_HSLIDER2, &CzebraDlg::OnStnClickedHslider2)
	//ON_STN_CLICKED(IDC_HSLIDER1, &CzebraDlg::OnStnClickedHslider1)
	//ON_STN_CLICKED(IDC_HSLIDER3, &CzebraDlg::OnStnClickedHslider3)
	ON_WM_HSCROLL()
	
	
	//ON_NOTIFY(NM_CUSTOMDRAW, IDC_H_SLIDER_BAR1, &CzebraDlg::OnNMCustomdrawHSliderBar1)
	//ON_NOTIFY(NM_CUSTOMDRAW, IDC_H_SLIDER_BAR2, &CzebraDlg::OnNMCustomdrawHSliderBar2)
	//ON_NOTIFY(NM_CUSTOMDRAW, IDC_H_SLIDER_BAR3, &CzebraDlg::OnNMCustomdrawHSliderBar3)
	ON_BN_CLICKED(IDC_CAPTURETRAIN, &CzebraDlg::OnBnClickedCapturetrain)
	ON_BN_CLICKED(IDC_LEARN, &CzebraDlg::OnBnClickedLearn)
	ON_BN_CLICKED(IDC_RECOGNISE, &CzebraDlg::OnBnClickedRecognise)
	ON_BN_CLICKED(IDC_COUNTER, &CzebraDlg::OnBnClickedCounter)
	ON_STN_CLICKED(IDC_ECHO, &CzebraDlg::OnStnClickedEcho)
	ON_BN_CLICKED(IDC_RESET, &CzebraDlg::OnBnClickedReset)
	ON_BN_CLICKED(IDC_StartLearning, &CzebraDlg::OnBnClickedStartlearning)
	ON_EN_CHANGE(IDC_NameOfDetectFace, &CzebraDlg::OnEnChangeNameofdetectface)
	ON_EN_CHANGE(IDC_IndicateFaceDetect, &CzebraDlg::OnEnChangeIndicatefacedetect)
	ON_BN_CLICKED(IDC_ClearImageDataBase, &CzebraDlg::OnBnClickedClearimagedatabase)
	ON_BN_CLICKED(IDC_01, &CzebraDlg::OnBnClicked01)
	ON_BN_CLICKED(IDC_02, &CzebraDlg::OnBnClicked02)
	ON_BN_CLICKED(IDC_03, &CzebraDlg::OnBnClicked03)
	ON_BN_CLICKED(IDC_04, &CzebraDlg::OnBnClicked04)
	ON_BN_CLICKED(IDC_05, &CzebraDlg::OnBnClicked05)
	ON_BN_CLICKED(IDC_06, &CzebraDlg::OnBnClicked06)
	ON_BN_CLICKED(IDC_07, &CzebraDlg::OnBnClicked07)
	ON_BN_CLICKED(IDC_08, &CzebraDlg::OnBnClicked08)
	ON_BN_CLICKED(IDC_09, &CzebraDlg::OnBnClicked09)
	ON_BN_CLICKED(IDC_10, &CzebraDlg::OnBnClicked10)
	ON_BN_CLICKED(IDC_11, &CzebraDlg::OnBnClicked11)
	ON_BN_CLICKED(IDC_12, &CzebraDlg::OnBnClicked12)
	ON_BN_CLICKED(IDC_13, &CzebraDlg::OnBnClicked13)
	ON_BN_CLICKED(IDC_14, &CzebraDlg::OnBnClicked14)
	ON_BN_CLICKED(IDC_15, &CzebraDlg::OnBnClicked15)
	ON_BN_CLICKED(IDC_16, &CzebraDlg::OnBnClicked16)
	ON_BN_CLICKED(IDC_17, &CzebraDlg::OnBnClicked17)
	ON_BN_CLICKED(IDC_18, &CzebraDlg::OnBnClicked18)
	ON_BN_CLICKED(IDC_19, &CzebraDlg::OnBnClicked19)
	ON_BN_CLICKED(IDC_20, &CzebraDlg::OnBnClicked20)
	ON_EN_CHANGE(IDC_Name, &CzebraDlg::OnEnChangeName)
	ON_EN_CHANGE(IDC_Box01, &CzebraDlg::OnEnChangeBox01)
	
	//ON_EN_CHANGE(IDC_DISPLAY, &CzebraDlg::OnEnChangeDisplay)
	ON_BN_CLICKED(IDC_ExitFrmCam, &CzebraDlg::OnBnClickedExitfrmcam)
	ON_EN_CHANGE(IDC_RICHEDIT21, &CzebraDlg::OnEnChangeRichedit21)
	ON_EN_CHANGE(IDC_EDIT1, &CzebraDlg::OnEnChangeEdit1)
	//ON_NOTIFY(TTN_GETDISPINFO, IDC_CUSTOM1, &CzebraDlg::OnTtnGetDispInfoCustom1)
	ON_EN_CHANGE(IDC_EDIT4, &CzebraDlg::OnEnChangeEdit4)
	//ON_BN_CLICKED(IDC_A2, &CzebraDlg::OnBnClickedA2)
	//ON_BN_CLICKED(IDC_I2, &CzebraDlg::OnBnClickedI2)
	//ON_EN_CHANGE(IDC_Box02, &CzebraDlg::OnEnChangeBox02)
	ON_BN_CLICKED(IDC_Instructions, &CzebraDlg::OnBnClickedInstructions)
	ON_BN_CLICKED(IDC_About, &CzebraDlg::OnBnClickedAbout)
	ON_EN_CHANGE(IDC_Box02, &CzebraDlg::OnEnChangeBox02)
END_MESSAGE_MAP()


// CzebraDlg message handlers

BOOL CzebraDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	ShowWindow(SW_MINIMIZE);

	// TODO: Add extra initialization here
	//---------------------------------------------
	NumName=1;
	m_HSLIDERBAR1.SetRange(0,100,TRUE);
	m_HSLIDERBAR1.SetPos(50);
	m_HSLIDER1.Format(L"%d",50);

	m_HSLIDERBAR2.SetRange(0,100,TRUE);
	m_HSLIDERBAR2.SetPos(50);
	m_HSLIDER2.Format(L"%d",50);

	m_HSLIDERBAR3.SetRange(0,100,TRUE);
	m_HSLIDERBAR3.SetPos(50);
	m_HSLIDER3.Format(L"%d",50);
	
	m_Display.Format(L"Project ID : 09A203                                         Project Supervisor: Mr Tan Hak Hwee        Co-Project Supervisor: Mr Tie Lok Ting        Members: Bliondi Lim, Alwin Yong, Ho Jun Long");

	m_echo.Format(L"%d", m_count);

	UpdateData(FALSE);
/*
//***************************
	cvNamedWindow( "MARIO", CV_WINDOW_AUTOSIZE );
	cvMoveWindow( "MARIO", 500, 500 );
	IplImage* start1;
		start1 = cvLoadImage( "D:\\FYP\\MARIO2.jpg", 1 );
		IplImage* start2 = 0;
	              start2 = cvCreateImage(cvSize(200, 200),            
								start1->depth, start1->nChannels);
				  cvResize( start1, start2, CV_INTER_LINEAR );
cvShowImage("MARIO", start2);


//****************************
*/

	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CzebraDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CzebraDlg::OnPaint()
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this function to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CzebraDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}


void CzebraDlg::OnBnClickedCamera()
{
	int use_camera = 1;
	input_video = cvCaptureFromCAM(-1);

	if (use_camera == 1) 
	{
    // Images to capture the frame from camera
    static IplImage *frame, *frame_copy = 0;
   
	// Create a new named window to show the camera video
    cvNamedWindow( "Camera", CV_WINDOW_AUTOSIZE );
	//cvResizeWindow( "Camera", 320, 240 );
	cvMoveWindow( "Camera", 678, 5 );


	// If loaded succesfully, then:
    if( input_video )
	{
		cvNamedWindow("Face Detected 1", 0);
		cvResizeWindow("Face Detected 1", 160, 160);
 
0
 

1. Don't fall in the magic pushButton mistake, try to separate gui and behavior.

2. How is RESULT_NEAREST variable declared ?

3. have you tried to debug, or just print out the value of RESULT_NEAREST after you compute it, let's say line 19 in your first file ?

 
0
 

Hello there, I tried debugging the values of "RESULT_NEAREST". The values are correct when different users that are already registered inside are captured, but I just noticed, that it always gives itself a value of "1" when an unrecognized person is captured, causing the problem. Is there a fix for this? Thanks for the reply.

This variable is declared in a another header file with it's function prototype. This header is included in the .cpp file I uploaded (declaration from header file below).

void recognize();
int RESULT_NEAREST = 0;
 
0
 

Sure, there is also a variable called RESULT_TRUTH. I don't know how it is filled, but maybe you could check the value of this variable to know if the detection was successful or not...

 
0
 

Hi, I just had a discussion with my boss. Apparently the algorithm may have some accuracy problems, so we will just wait that part out with the higher-ups. Now though I'm trying make the code more optimized and easier to read but I seem to have a small problem.

I'm trying to replace this entire section (below)

if (RESULT_NEAREST == 1) //Nearest refers to ID of person being recognized
    {
        cvNamedWindow( "ID01", 0 );
        cvResizeWindow( "ID01", 160, 160 );
        cvMoveWindow( "ID01", 673, 506 );
        Identified_Person_Img = cvLoadImage( "D:\\FYP\\01\\1.jpg", 1 );
        cvShowImage("ID01", Identified_Person_Img);
        EEE(node_number=0); //meant for hardware interfacing, not used
    }
    if (RESULT_NEAREST !=1)
    {
        if (RESULT_NEAREST == 2)
        {
            cvNamedWindow( "ID02", 0 );
            cvResizeWindow( "ID02", 160, 160 );
            cvMoveWindow( "ID02", 673, 506 );
            Identified_Person_Img = cvLoadImage( "D:\\FYP\\02\\1.jpg", 1 );
            cvShowImage("ID02", Identified_Person_Img);
            EEE(node_number=1);
        }
    }
    if (!(RESULT_NEAREST == 1) && !(RESULT_NEAREST == 2))
    {
        cvNamedWindow( "Unknown Face Detected", 0 );
        cvResizeWindow( "Unknown Face Detected", 160, 160 );
        cvMoveWindow( "Unknown Face Detected", 673, 506 );
        IplImage* UnknownFace;
        UnknownFace = cvLoadImage( "D:\\FYP\\MARIO1.jpg", 1 );
        IplImage *FUnknownFace = 0;
        FUnknownFace = cvCreateImage(cvSize(160, 160),            
            UnknownFace->depth, UnknownFace->nChannels);
        cvResize( UnknownFace, FUnknownFace, CV_INTER_LINEAR );
        cvShowImage("Unknown Face Detected", FUnknownFace);
        EEE(node_number=20);
    }

With this

char buffer[50];
	int n;
	n = sprintf (buffer,"D:\\FYP\\0%d\\1.jpg", RESULT_NEAREST);
		cvNamedWindow( "ID", 0 );
		cvResizeWindow( "ID", 160, 160 );
		cvMoveWindow( "ID", 673, 506 );
		Identified_Person_Img = cvLoadImage( n, 1 ); //Actual file directory is "D:/FYP/<ID number, eg. 01,02,etc>/1.jpg
		cvShowImage("ID", Identified_Person_Img);
		EEE(node_number=ID);

if (RESULT_NEAREST !=1 && RESULT_NEAREST !=2)
		{
		cvNamedWindow( "Unknown Face Detected", 0 );
		cvResizeWindow( "Unknown Face Detected", 160, 160 );
		cvMoveWindow( "Unknown Face Detected", 673, 506 );
		IplImage* UnknownFace;
		UnknownFace = cvLoadImage( "D:\\FYP\\MARIO1.jpg", 1 );
		IplImage *FUnknownFace = 0;
	              FUnknownFace = cvCreateImage(cvSize(160, 160),            
								UnknownFace->depth, UnknownFace->nChannels);
				  cvResize( UnknownFace, FUnknownFace, CV_INTER_LINEAR );
		cvShowImage("Unknown Face Detected", FUnknownFace);
		EEE(node_number=20);
		}

But I seem to get a "error C2664: 'cvLoadImage' : cannot convert parameter 1 from 'int' to 'const char *'" problem. I've tried changing the variable types when I declared them (below) but with no effect. Using the debugger, my values when I click the button are correct so I think it is a problem is in my syntax with how I called the pop-up and the file directory. Is there a way to fix it? Thanks a lot in advance.

*note, these 2 are declared in a separate header file but I don't think it should matter.

int ID=0;
int RESULT_NEAREST = 0;

Loading the face image

for(iFace=0; iFace<nFaces; iFace++)
	{
		// read person number and name of image file
		fscanf(imgListFile,"%d %s", personNumTruthMat->data.i+iFace, imgFilename);
		

		// load the face image
		faceImgArr[iFace] = cvLoadImage(imgFilename,  CV_LOAD_IMAGE_GRAYSCALE);

		if( !faceImgArr[iFace] )
		{
			/*fprintf(stderr, "Can\'t load image from %s\n", imgFilename);*/
			return 0;
		}
	}
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: