Skip to content

Commit

Permalink
add sth
Browse files Browse the repository at this point in the history
  • Loading branch information
tkorays committed May 23, 2014
1 parent 782309e commit 363867e
Show file tree
Hide file tree
Showing 12 changed files with 213 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
/FaceStorage_Test/face_hist.xml

ext/cxxlib/
*~
*.swp
*.swap
124 changes: 62 additions & 62 deletions FaceStorage_Test/FaceStorage_Test.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\ext\tinyxml\tinystr.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxml.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlerror.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlparser.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\ext\tinyxml\tinystr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\ext\tinyxml\tinyxml.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceStorage.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceStorage_impl.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceRecog.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceRecog_impl.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FrAdapter.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\CvFrAdapter.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\CvFrAdapter_impl.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\ext\tinyxml\tinystr.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxml.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlerror.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlparser.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\ext\tinyxml\tinystr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\ext\tinyxml\tinyxml.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceStorage.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceStorage_impl.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceRecog.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FaceRecog_impl.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\FrAdapter.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\CvFrAdapter.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\face\CvFrAdapter_impl.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions face/CvFrAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include "FrAdapter.h"
#include "FaceStorage.h"

#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\contrib\contrib.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/contrib/contrib.hpp>
using namespace cv;

// 使用opencv的人脸识别
Expand All @@ -33,4 +33,4 @@ class CvFrAdapter : public FrAdapter {

#include "CvFrAdapter_impl.h"

#endif // _TK_CVFRADAPTER_H_
#endif // _TK_CVFRADAPTER_H_
4 changes: 2 additions & 2 deletions face/FaceRecog.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using namespace std;


#include <opencv2\core\core.hpp>
#include <opencv2/core/core.hpp>
using namespace cv;
#include "FrAdapter.h"

Expand All @@ -23,4 +23,4 @@ class FaceRecog {

#include "FaceRecog_impl.h"

#endif // _TK_FACERECOG_H_
#endif // _TK_FACERECOG_H_
4 changes: 2 additions & 2 deletions face/FrAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _TK_FRADAPTER_H_
#pragma once

#include <opencv2\core\core.hpp>
#include <opencv2/core/core.hpp>

// ÊÊÅäÆ÷µÄ½Ó¿Ú
class FrAdapter {
Expand All @@ -13,4 +13,4 @@ class FrAdapter {
virtual string getNameById(int id) = 0;
};

#endif // _TK_FRADAPTER_H_
#endif // _TK_FRADAPTER_H_
88 changes: 44 additions & 44 deletions face_recog_demo/face_recog_demo.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="face_recog.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinystr.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxml.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlerror.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlparser.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="lib_helper.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\ext\tinyxml\tinystr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\ext\tinyxml\tinyxml.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="face_recog.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinystr.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxml.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlerror.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\ext\tinyxml\tinyxmlparser.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="lib_helper.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\ext\tinyxml\tinystr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\ext\tinyxml\tinyxml.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>
Binary file added fr_demo_linux/a.out
Binary file not shown.
6 changes: 6 additions & 0 deletions fr_demo_linux/cpl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

g++ -std=c++11 `pkg-config --cflags opencv` -o fr \
./fr.cpp ../ext/tinyxml/tinystr.cpp ../ext/tinyxml/tinyxml.cpp \
../ext/tinyxml/tinyxmlerror.cpp ../ext/tinyxml/tinyxmlparser.cpp \
`pkg-config --libs opencv`
Binary file added fr_demo_linux/fr
Binary file not shown.
51 changes: 51 additions & 0 deletions fr_demo_linux/fr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* =====================================================================================
*
* Filename: fr.cpp
*
* Description: face recognition
*
* Version: 1.0
* Created: 2014年05月23日 13时32分42秒
* Revision: none
* Compiler: gcc
*
* Author: tkorays (tk), [email protected]
* Organization:
*
* =====================================================================================
*/
//#include <opencv/core/core.h>
//#include <opencv/highgui.h>
//#include <opencv/contrib/contrib.h>
//using namespace cv;

#include "../face/FaceRecog.h"
#include "../face/CvFrAdapter.h"

#include <iostream>
using namespace std;

void check_status(bool status,string msg){
if(!status){
cout<<msg<<endl;
exit(0);
}
}

int main(int argc,char** argv){
string dir_prefix = "/home/tkorays/pic/face_data/";
FaceRecog fr;

CvFrAdapter cvfr;
cvfr.setFaceStorage(dir_prefix+"face_list.xml");
fr.setFrClass(&cvfr);

bool status = fr.train();
check_status(status,"Train failed...");

int ret = fr.pridect(imread(dir_prefix+"xujian/small/9.jpg",CV_LOAD_IMAGE_GRAYSCALE));
cout<<"The guy is: "+fr.getNameById(ret)<<endl;

return 0;
}
Binary file added fr_demo_linux/test
Binary file not shown.
Loading

0 comments on commit 363867e

Please sign in to comment.