Fixed all warnings by Visual Studio 2013.

1.3
Micooz 11 years ago
parent 3af6a95e11
commit 856c3fe71b

@ -101,7 +101,7 @@ int CCharsSegment::charsSegment(Mat input, vector<Mat>& resultVec) {
int w = input_grey.cols;
int h = input_grey.rows;
Mat tmp = input_grey(Rect_<double>(w * 0.1, h * 0.1, w * 0.8, h * 0.8));
Mat tmp = input_grey(Rect_<double>(w * 0.1, h * 0.1, w * 0.8, h * 0.8));
int threadHoldV = ThresholdOtsu(tmp);
// utils::imwrite("E:/img_inputgray2.jpg", input_grey);
@ -116,7 +116,7 @@ int CCharsSegment::charsSegment(Mat input, vector<Mat>& resultVec) {
img_threshold = input_grey.clone();
int w = input_grey.cols;
int h = input_grey.rows;
Mat tmp = input_grey(Rect_<double>(w * 0.1, h * 0.1, w * 0.8, h * 0.8));
Mat tmp = input_grey(Rect_<double>(w * 0.1, h * 0.1, w * 0.8, h * 0.8));
int threadHoldV = ThresholdOtsu(tmp);
utils::imwrite("resources/image/tmp/inputgray2.jpg", input_grey);
@ -270,13 +270,13 @@ int CCharsSegment::SortRect(const vector<Rect>& vecRect, vector<Rect>& out) {
orderIndex.push_back(i);
xpositions.push_back(vecRect[i].x);
}
int min = xpositions[0];
int minIdx = 0;
for (size_t i = 0; i < xpositions.size(); i++) {
min = xpositions[i];
minIdx = i;
for (size_t j = i; j < xpositions.size(); j++) {
for (size_t j = i; j < xpositions.size(); j++) {
if (xpositions[j] < min) {
min = xpositions[j];
minIdx = j;

@ -290,7 +290,7 @@ bool plateColorJudge(const Mat& src, const Color r, const bool adaptive_minsv,
float& percent) {
// ÅжÏãÐÖµ
const float thresh = 0.45f;
Mat src_gray;
colorMatch(src, src_gray, r, adaptive_minsv);

@ -3,12 +3,10 @@
/*! \namespace easypr
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr{
namespace easypr {
CPlate::CPlate()
{
//cout << "CPlate" << endl;
bColored = true;
}
CPlate::CPlate() {
bColored = true;
}
} /*! \namespace easypr*/
} /*! \namespace easypr*/

@ -83,7 +83,7 @@ int CPlateDetect::plateDetectDeep(Mat src, vector<CPlate>& resultVec,
sobel_result_Plates.push_back(sobel_Plates[i]);
}*/
for (size_t i = 0; i < sobel_result_Plates.size(); i++) {
for (size_t i = 0; i < sobel_result_Plates.size(); i++) {
CPlate plate = sobel_result_Plates[i];
if (0) {
@ -110,7 +110,7 @@ int CPlateDetect::plateDetectDeep(Mat src, vector<CPlate>& resultVec,
int CPlateDetect::showResult(const Mat& result) {
namedWindow("EasyPR", CV_WINDOW_AUTOSIZE);
const int RESULTWIDTH = 640; // 640 930
const int RESULTWIDTH = 640; // 640 930
const int RESULTHEIGHT = 540; // 540 710
Mat img_window;

@ -7,7 +7,7 @@ using namespace std;
Namespace where all the C++ EasyPR functionality resides
*/
namespace easypr {
const float DEFAULT_ERROR = 0.9f; // 0.6
const float DEFAULT_ASPECT = 3.75f; // 3.75
@ -322,8 +322,8 @@ int CPlateLocate::sobelSecSearchPart(Mat& bound, Point2f refpoint,
//找到两个边界后进行连接修补处理
if (posRight != 0 && posLeft != 0 && posLeft < posRight) {
int posY = int(bound_threshold.rows * 0.5);
for (int i = posLeft + (int)(bound_threshold.rows * 0.1); i < posRight - 4;
i++) {
for (int i = posLeft + (int)(bound_threshold.rows * 0.1);
i < posRight - 4; i++) {
bound_threshold.data[posY * bound_threshold.cols + i] = 255;
}
}
@ -504,7 +504,7 @@ void DeleteNotArea(Mat& inmat) {
Mat img_threshold;
if (BLUE == plateType) {
img_threshold = input_grey.clone();
Mat tmp = input_grey(Rect_<double>(w * 0.15, h * 0.15, w * 0.7, h * 0.7));
Mat tmp = input_grey(Rect_<double>(w * 0.15, h * 0.15, w * 0.7, h * 0.7));
int threadHoldV = ThresholdOtsu(tmp);
threshold(input_grey, img_threshold, threadHoldV, 255, CV_THRESH_BINARY);
@ -515,7 +515,7 @@ void DeleteNotArea(Mat& inmat) {
} else if (YELLOW == plateType) {
img_threshold = input_grey.clone();
Mat tmp = input_grey(Rect_<double>(w * 0.1, h * 0.1, w * 0.8, h * 0.8));
Mat tmp = input_grey(Rect_<double>(w * 0.1, h * 0.1, w * 0.8, h * 0.8));
int threadHoldV = ThresholdOtsu(tmp);
threshold(input_grey, img_threshold, threadHoldV, 255,
@ -963,7 +963,7 @@ int CPlateLocate::deskewOld(Mat src, vector<RotatedRect>& inRects,
plTri[1] = Point2f(middle_crop.cols - 1.f, 0);
plTri[2] = Point2f(0 + (float)xdiff, middle_crop.rows - 1.f);
}
dstTri[0] = Point2f(0, 0);
dstTri[1] = Point2f(WIDTH - 1, 0);
dstTri[2] = Point2f(0, HEIGHT - 1);
@ -1141,11 +1141,11 @@ int CPlateLocate::plateSobelLocate(Mat src, vector<CPlate>& candPlates,
Point2f refpoint(bound_rect.x, bound_rect.y);
float x = bound_rect.x > 0 ? bound_rect.x : 0;
float y = bound_rect.y > 0 ? bound_rect.y : 0;
float y = bound_rect.y > 0 ? bound_rect.y : 0;
float width =
float width =
x + bound_rect.width < src.cols ? bound_rect.width : src.cols - x;
float height =
float height =
y + bound_rect.height < src.rows ? bound_rect.height : src.rows - y;
Rect_<float> safe_bound_rect(x, y, width, height);
@ -1159,15 +1159,15 @@ int CPlateLocate::plateSobelLocate(Mat src, vector<CPlate>& candPlates,
Rect_<float> bound_rect = bound_rects[i];
Point2f refpoint(bound_rect.x, bound_rect.y);
float x = bound_rect.x > 0 ? bound_rect.x : 0;
float y = bound_rect.y > 0 ? bound_rect.y : 0;
float x = bound_rect.x > 0 ? bound_rect.x : 0;
float y = bound_rect.y > 0 ? bound_rect.y : 0;
float width =
float width =
x + bound_rect.width < src.cols ? bound_rect.width : src.cols - x;
float height =
float height =
y + bound_rect.height < src.rows ? bound_rect.height : src.rows - y;
Rect_<float> safe_bound_rect(x, y, width, height);
Rect_<float> safe_bound_rect(x, y, width, height);
Mat bound_mat = src(safe_bound_rect);
// Sobel第二次精细搜索

@ -40,6 +40,8 @@ int accuracyTest(const char* test_path) {
int count_err = 0;
// 未识别的图片数量
int count_norecogin = 0;
// not recognized pictures
std::list<std::string> not_recognized_files;
// 总的字符差距
float diff_all = 0;
@ -76,7 +78,10 @@ int accuracyTest(const char* test_path) {
if (num == 0) {
cout << "无车牌" << endl;
if (plateLicense != "无车牌") count_norecogin++;
if (plateLicense != "无车牌") {
not_recognized_files.push_back(plateLicense);
count_norecogin++;
}
} else if (num > 1) {
// 多车牌使用diff最小的那个记录
int mindiff = 10000;
@ -142,11 +147,15 @@ int accuracyTest(const char* test_path) {
float count_recogin = float(count_all - (count_err + count_norecogin));
float count_rate = count_recogin / count_all;
// float count_norate = 1 - count_rate;
cout << "定位率:" << count_rate * 100 << "% " << endl;
diff_avg = diff_all / count_recogin;
match_rate = match_count / count_recogin * 100;
if (count_recogin > 0) {
diff_avg = diff_all / count_recogin;
}
if (count_recogin > 0) {
match_rate = match_count / count_recogin * 100;
}
cout << "平均字符差距:" << diff_avg << "个, ";
cout << "完全匹配数:" << match_count << "张, ";
@ -156,7 +165,14 @@ int accuracyTest(const char* test_path) {
double avgsec = seconds / double(count_all);
cout << "总时间:" << seconds << "秒, ";
cout << "平均执行时间:" << avgsec << "" << endl;
cout << "平均执行时间:" << avgsec << "" << endl;
cout << "未识出图片:" << endl;
for (auto it = not_recognized_files.begin(); it != not_recognized_files.end();
++it) {
cout << *it << endl;
}
cout << endl;
@ -178,7 +194,7 @@ int accuracyTest(const char* test_path) {
myfile << "完全匹配数:" << match_count << "张, ";
myfile << "完全匹配率:" << match_rate << "% " << endl;
myfile << "总时间:" << seconds << "秒, ";
myfile << "平均执行时间:" << avgsec << " " << endl;
myfile << "平均执行时间:" << avgsec << "" << endl;
myfile.close();
} else {
cout << "Unable to open file";

Loading…
Cancel
Save