Merge branch 'Micooz-master-gbk'

1.3
liuruoze 10 years ago
commit 91099ead27

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
project (EasyPR)
@ -8,29 +8,29 @@ find_package(OpenCV REQUIRED)
set(CMAKE_SOURCE_DIR ./src)
include_directories(${CMAKE_SOURCE_DIR}/include/)
set(SOURCE_FILES
src/main.cpp
src/core/chars_identify.cpp
src/core/chars_recognise.cpp
src/core/chars_segment.cpp
src/core/features.cpp
src/core/plate_detect.cpp
src/core/plate_judge.cpp
src/core/plate_locate.cpp
src/core/plate_recognize.cpp
src/test/accuracy_test.cpp
src/test/test.cpp
src/train/ann_train.cpp
src/train/svm_train.cpp
src/util/deface.cpp
src/util/general_test_prepare.cpp
src/util/generate_gdts.cpp
src/util/learn_prepare.cpp
src/util/mc_data_prepare.cpp
src/util/util.cpp
src/util/CParser.cpp
src/main.cpp
src/core/core_func.cpp
src/core/chars_identify.cpp
src/core/chars_recognise.cpp
src/core/chars_segment.cpp
src/core/features.cpp
src/core/plate.cpp
src/core/plate_detect.cpp
src/core/plate_judge.cpp
src/core/plate_locate.cpp
src/core/plate_recognize.cpp
src/test/accuracy_test.cpp
src/test/test.cpp
src/train/ann_train.cpp
src/train/svm_train.cpp
src/util/deface.cpp
src/util/general_test_prepare.cpp
src/util/generate_gdts.cpp
src/util/learn_prepare.cpp
src/util/mc_data_prepare.cpp
src/util/util.cpp
src/util/CParser.cpp
)
add_executable(EasyPR ${SOURCE_FILES})

@ -733,3 +733,11 @@
总图片数:120张, 未识出图片:7张, 定位率:94.1667%
平均字符差距:2.0177个, 完全匹配数:26张, 完全匹配率:23.0089%
总时间:93秒, 平均执行时间:0.775秒
2015-03-20 17:55:32
总图片数:1张, 未识出图片:1张, 定位率:0%
平均字符差距:-1.#IND个, 完全匹配数:0张, 完全匹配率:-1.#IND%
总时间:1秒, 平均执行时间:1秒
2015-03-20 18:02:03
总图片数:120张, 未识出图片:7张, 定位率:94.1667%
平均字符差距:2.0177个, 完全匹配数:26张, 完全匹配率:23.0089%
总时间:86秒, 平均执行时间:0.716667秒

@ -1282,8 +1282,9 @@ int CPlateLocate::plateLocate(Mat src, vector<Mat>& resultVec, int index)
//large the rect for more
if (!verifySizes(mr))
{
cv::Mat& roi = dst_blue(safeBoundRect);
cv::Mat roi = dst_blue(safeBoundRect);
roi.setTo(0);
cv::swap(roi, dst_blue);
}
else
{
@ -1336,8 +1337,9 @@ int CPlateLocate::plateLocate(Mat src, vector<Mat>& resultVec, int index)
//large the rect for more
if (!verifySizes(mr))
{
cv::Mat& roi = dst_yellow(safeBoundRect);
cv::Mat roi = dst_yellow(safeBoundRect);
roi.setTo(0);
cv::swap(roi, dst_yellow);
}
else
{

@ -65,4 +65,4 @@ private:
} /* \namespace easypr */
#endif /* endif __PLATE_RECOGNITION_H__ */
#endif /* endif __PLATE_RECOGNITION_H__ */

@ -17,7 +17,7 @@
#if defined (WIN32) || defined (_WIN32)
#include <io.h>
#elif defined (linux) || defined (__linux__)
#include <sys/io.h>
#endif
#include <iostream>
@ -26,7 +26,7 @@
#include <algorithm>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <math.h>
using namespace std;
using namespace cv;

@ -1,42 +1,53 @@
#ifndef __UTIL_H__
#define __UTIL_H__
#include <vector>
#include <string>
#ifdef min
#undef min
#undef min
#endif
#ifdef max
#undef max
#endif
namespace easypr {
class Utils {
public:
static long getTimestamp();
/*
* Get file name from a given path
* bool postfix: including the postfix
*/
static std::string getFileName(const std::string &path, const bool postfix = false);
/*
* Split the given string into segements by a delimiter
*/
static std::vector<std::string> splitString(const std::string &str, const char delimiter);
/*
* returns the smaller of the two numbers
*/
template<typename T>
static T min(const T &v1, const T &v2) {
return (v1 < v2) ? v1 : v2;
}
};
}
//C++µÄ»ñÈ¡Îļþ¼Ðº¯Êý
void getFiles(std::string path, std::vector<std::string>& files);
class Utils {
public:
static long getTimestamp();
/*
* Get file name from a given path
* bool postfix: including the postfix
*/
static std::string getFileName(const std::string& path,
const bool postfix = false);
/*
* Split the given string into segements by a delimiter
*/
static std::vector<std::string> splitString(const std::string& str,
const char delimiter);
/*
* returns the smaller of the two numbers
*/
template <typename T>
static T min(const T& v1, const T& v2) {
return (v1 < v2) ? v1 : v2;
}
/*
* Get files from a given folder
* all: including all sub-folders
*/
static std::vector<std::string> getFiles(const std::string& folder,
const bool all = true);
};
}
//! levenshtein距离用于计算两个车牌的距离
//EasyPR中用levenshtein距离衡量车牌识别与真实车牌的误差

@ -430,4 +430,4 @@ void cmdMain(int argc, char *argv[])
} catch (const std::exception &err) {
cout << err.what() << endl;
}
}
}

File diff suppressed because it is too large Load Diff

@ -269,14 +269,14 @@ int test_plate_detect()
{
cout << "test_plate_detect" << endl;
//Mat src = imread("image/plate_detect.jpg");
Mat src = imread("image/baidu_image/test1.jpg");
Mat src = imread("image/plate_detect.jpg");
//Mat src = imread("image/baidu_image/test1.jpg");
vector<Mat> resultVec;
CPlateDetect pd;
pd.setPDLifemode(true);
int result = pd.plateDetect(src, resultVec);
int result = pd.plateDetectDeep(src, resultVec);
if (result == 0)
{
int num = resultVec.size();

@ -16,7 +16,7 @@
#if defined (WIN32) || defined (_WIN32)
#include <io.h>
#elif defined (linux) || defined (__linux__)
#include <sys/io.h>
//#include <sys/io.h>
#endif
#include <stdlib.h>
@ -140,8 +140,7 @@ int saveTrainData()
stringstream ss(stringstream::in | stringstream::out);
ss << path << "/" << strCharacters[i];
vector<string> files;
getFiles(ss.str(), files);
auto files = Utils::getFiles(ss.str());
int size = files.size();
for (int j = 0; j < size; j++)
@ -168,9 +167,8 @@ int saveTrainData()
cout << "Character: "<< strChinese[i] << "\n";
stringstream ss(stringstream::in | stringstream::out);
ss << path << "/" << strChinese[i];
vector<string> files;
getFiles(ss.str(), files);
auto files = Utils::getFiles(ss.str());
int size = files.size();
for (int j = 0; j < size; j++)
@ -276,4 +274,4 @@ int annMain()
int end;
cin >> end;
return 0;
}
}

@ -13,10 +13,9 @@ void learn2HasPlate(float bound = 0.7)
{
const char * filePath = "train/data/plate_detect_svm/learn/HasPlate";
vector<string> files;
////获取该路径下的所有文件
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size) {
@ -60,10 +59,9 @@ void learn2NoPlate(float bound = 0.7)
{
const char * filePath = "train/data/plate_detect_svm/learn/NoPlate";
vector<string> files;
////获取该路径下的所有文件
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size) {
cout << "File not found in " << filePath << endl;
@ -107,10 +105,9 @@ void getHasPlateTrain(Mat& trainingImages, vector<int>& trainingLabels,
{
int label = 1;
const char * filePath = "train/data/plate_detect_svm/train/HasPlate";
vector<string> files;
////获取该路径下的所有文件
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size) {
@ -139,10 +136,9 @@ void getNoPlateTrain(Mat& trainingImages, vector<int>& trainingLabels,
{
int label = 0;
const char * filePath = "train/data/plate_detect_svm/train/NoPlate";
vector<string> files;
////获取该路径下的所有文件
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size) {
@ -169,10 +165,9 @@ void getHasPlateTest(vector<Mat>& testingImages, vector<int>& testingLabels)
{
int label = 1;
const char * filePath = "train/data/plate_detect_svm/test/HasPlate";
vector<string> files;
////获取该路径下的所有文件
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size) {
@ -194,10 +189,9 @@ void getNoPlateTest(vector<Mat>& testingImages, vector<int>& testingLabels)
{
int label = 0;
const char * filePath = "train/data/plate_detect_svm/test/NoPlate";
vector<string> files;
////获取该路径下的所有文件
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size) {

@ -19,8 +19,7 @@ const string dst_path = "F:/data/easypr-data/tmp-6";
int general_test()
{
////获取该路径下的所有文件
vector<string> files;
getFiles(src_path, files);
auto files = Utils::getFiles(src_path);
CPlateLocate lo;
CPlateJudge ju;

@ -31,8 +31,7 @@ int generate_gdts()
string cascadeName="model/haarcascade_frontalface_alt_tree.xml";
////获取该路径下的所有文件
vector<string> files;
getFiles(src_path, files);
auto files = Utils::getFiles(src_path);
int size = files.size();
if (0 == size)

@ -24,8 +24,7 @@ char * noPlatePath = "F:/data/easypr-data/learn/noPlate/";
void label_data()
{
////获取该路径下的所有文件
vector<string> files;
getFiles(notlabelPath, files);
auto files = Utils::getFiles(notlabelPath);
CPlateLocate lo;
CPlateJudge ju;

@ -9,7 +9,7 @@
#if defined (WIN32) || defined (_WIN32)
#include <io.h>
#elif defined (linux) || defined (__linux__)
#include <sys/io.h>
//#include <sys/io.h>
#endif
#include <opencv/cv.h>
@ -24,8 +24,6 @@ using namespace easypr;
const int LEARANDATA_COUNT = 5000;
void getFiles( string path, vector<string>& files );
//! 省份对应map
map<string, string> mc_map;
@ -195,8 +193,7 @@ void getLearnData()
const char * filePath = "F:/data/easypr-data/rawdata";
////获取该路径下的所有文件
vector<string> files;
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size) {
@ -248,8 +245,7 @@ void changeFileName()
char * filePath = "F:/data/PlateLocate/pic1";
////获取该路径下的所有文件
vector<string> files;
getFiles(filePath, files );
auto files = Utils::getFiles(filePath);
int size = files.size();
if (0 == size)
@ -276,4 +272,4 @@ void changeFileName()
}
}
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save