Home > Back-end >  Can't locate the program input point in the dynamic link library
Can't locate the program input point in the dynamic link library

Time:11-07

#include
#include
#include
#include
#include
#include

//namespace
using namespace std;
Using the namespace CV;
Using the namespace face;

CascadeClassifier faceDetect;//face detection object

//function declaration
Vector FaceDetector Mat (img);//inspection face, and return to face region
Void DrawFace (Mat img, vector Faces);//will face out
Void GetFilesName (string path, vector & FilesName);//get all the files in the folder name

Int main ()
{
//variable
Mat frame;
Mat SRC.
Mat facePic;
Mat recogPic;

Vector Faces;
Vector FilesName;
String path=".. \ \ TrainPic ";
String PIC;

Vector TrainPic;//training images
Vector Labels.//the one-to-one training pictures tag
Int result;
Map LabelsInfo;
FaceDetect. Load ("../models/haarcascade_frontalface_alt2. XML ");

Ptr LBPHRecog=LBPHFaceRecognizer: : create (1, 8, 3, 3, 50);//structure LBPH face recognition class object and initializes the
//load face library
GetFilesName (path, filesName);
For (int I=0; I & lt; FilesName. The size (); I++)
{
PIC=filesName [I];
SRC=https://bbs.csdn.net/topics/imread (PIC);
CvtColor (SRC, SRC, CV_RGB2GRAY);
TrainPic. Push_back (SRC);
LabelsInfo. Insert (make_pair (I, filesName [I]));
Labels. The push_back (I);
}
//LBPHRecog - & gt; SetLabelsInfo (labelsInfo);
LBPHRecog - & gt; "Train" (trainPic, labels);//LBP face recognition training function

VideoCapture cap (0);//open the camera
Int c=0;
if (! Cap. IsOpened ())
{
Cerr & lt; <"Camera unable to open" & lt; }

While (c!=27)
{
Cap & gt;> Frame;
Flip (frame, frame, 1);
RecogPic=Mat: : zeros (200, 200, frame. The type ());
Double t=(double) getTickCount ();//testing time
Faces=FaceDetector (frame);
T=((double) getTickCount () - t)/getTickFrequency ();
cout DrawFace (frame, faces);

For (size_t I=0; I & lt; Faces. The size (); I++)
{
FacePic=frame (the Rect (faces [I]));
The resize (facePic recogPic, recogPic. The size ());
CvtColor (recogPic recogPic, CV_RGB2GRAY);
//equalizeHist (recogPic recogPic);
Result=LBPHRecog - & gt; Predict (recogPic);//identification
//will identify according to the results on real-time picture
If (result==1)
PutText (frame, "unknow", Point (faces [I] x, faces [I] y), 3, 0.5, Scalar (0, 255, 255), 1);
The else
PutText (frame, filesName [result], Point (faces [I] x, faces [I] y), 3, 0.5, Scalar (0, 255, 255), 1);
}

Imshow (" 1 ", the frame);

C=waitKey (1);
}

return 0;
}

Vector FaceDetector Mat (img)
{
Mat SRC=https://bbs.csdn.net/topics/Mat::zeros (240, 320, img. The type ());
Vector Faces;
CvtColor (img, img, CV_RGB2GRAY);
The resize (img SRC, SRC. The size ());
FaceDetect. DetectMultiScale (SRC, faces, 1.2, 6, 0, the Size (30, 30));
For (int I=0; I & lt; Faces. The size (); I++)
{
Faces [I]. X=faces [I] x * 2;
Faces [I] y=faces [I] y * 2;
Faces [I]. Width=faces [I] width * 2;
Faces [I]. Height=faces [I] height * 2;
}
Return faces;
}

Void DrawFace (Mat img, vector Faces)
{
For (size_t num=0; Num & lt; Faces. The size (); Num++)
{
A rectangle (img, Point (faces) [r]. Num x, faces [num] y),
Point (faces [num]. X + faces [num]. Width, faces [num] y + faces [r]. Num height), Scalar (0, 255, 0) and 1, 8).
}
}

Void GetFilesName (string path, vector & FilesName)
{
//file handle
Long hFile=0;
//file information
Struct _finddata_t the fileinfo;
String p;
If ((hFile=_findfirst (p.a ssign (path), append (" \ \ * "). The c_str (), & amp; The fileinfo))!=1)
{
Do
{
//if it is a directory, iteration of the
//if not, add list
If ((the fileinfo attrib & amp; _A_SUBDIR))
{
If (STRCMP (the fileinfo. Name, "")!=0 & amp; & The STRCMP (the fileinfo. The name ".. ")!=0)
GetFilesName (p.a ssign (path), append (" \ \ "), append (the fileinfo. Name), filesName);
}
The else
{
FilesName. Push_back (p.a ssign (path). Append (" \ \ "). Append (the fileinfo. Name));
}
} while (_findnext (hFile, & amp; The fileinfo)==0);
_findclose (hFile);
}
}

CodePudding user response:

Library is a library of c + +, you use DLLs must compile with the main program of the same c + + compiler to just go, otherwise you will find symbol, because different compiler (or even different versions of the compiler) same name mangling methods used can be different

CodePudding user response:

reference 1/f, play big shoot early nuclear response:
library is a library of c + +, you use DLLs must compile with the main program of the same c + + compiler to just go, otherwise you will find symbol, because different compiler (and even different versions of the compiler) also use name mangling method may be different

I was using vs compiled for him
  • Related