1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
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();
}
}
|