From edba417b3e41ca852fc35a4ed98adc17a935fbbd Mon Sep 17 00:00:00 2001 From: Micooz Date: Thu, 11 Jun 2015 16:42:08 +0800 Subject: [PATCH] Fixed "int" type mismatch "size_t" warnings. --- src/core/plate_detect.cpp | 6 +++--- src/core/plate_locate.cpp | 22 +++++++++++----------- src/preprocess/gdts.cpp | 2 +- src/train/ann_train.cpp | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core/plate_detect.cpp b/src/core/plate_detect.cpp index e87b947..4e7d82b 100644 --- a/src/core/plate_detect.cpp +++ b/src/core/plate_detect.cpp @@ -66,7 +66,7 @@ int CPlateDetect::plateDetectDeep(Mat src, vector& resultVec, // color_result_Plates.push_back(color_Plates[i]); //} - for (int i = 0; i < color_result_Plates.size(); i++) { + for (size_t i = 0; i < color_result_Plates.size(); i++) { CPlate plate = color_result_Plates[i]; plate.setPlateLocateType(COLOR); @@ -83,7 +83,7 @@ int CPlateDetect::plateDetectDeep(Mat src, vector& resultVec, sobel_result_Plates.push_back(sobel_Plates[i]); }*/ - for (int 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) { @@ -99,7 +99,7 @@ int CPlateDetect::plateDetectDeep(Mat src, vector& resultVec, } } - for (int i = 0; i < all_result_Plates.size(); i++) { + for (size_t i = 0; i < all_result_Plates.size(); i++) { // 把截取的车牌图像依次放到左上角 CPlate plate = all_result_Plates[i]; resultVec.push_back(plate); diff --git a/src/core/plate_locate.cpp b/src/core/plate_locate.cpp index f7ddd6a..c4c0e80 100644 --- a/src/core/plate_locate.cpp +++ b/src/core/plate_locate.cpp @@ -278,7 +278,7 @@ int CPlateLocate::sobelFrtSearch(const Mat& src, ++itc; } - for (int i = 0; i < first_rects.size(); i++) { + for (size_t i = 0; i < first_rects.size(); i++) { RotatedRect roi_rect = first_rects[i]; Rect_ safeBoundRect; @@ -353,7 +353,7 @@ int CPlateLocate::sobelSecSearchPart(Mat& bound, Point2f refpoint, ++itc; } - for (int i = 0; i < second_rects.size(); i++) { + for (size_t i = 0; i < second_rects.size(); i++) { RotatedRect roi = second_rects[i]; if (verifySizes(roi)) { Point2f refcenter = roi.center + refpoint; @@ -425,7 +425,7 @@ int CPlateLocate::sobelSecSearch(Mat& bound, Point2f refpoint, ++itc; } - for (int i = 0; i < second_rects.size(); i++) { + for (size_t i = 0; i < second_rects.size(); i++) { RotatedRect roi = second_rects[i]; if (verifySizes(roi)) { Point2f refcenter = roi.center + refpoint; @@ -557,7 +557,7 @@ int CPlateLocate::deskew(const Mat& src, const Mat& src_b, Mat mat_debug; src.copyTo(mat_debug); - for (int i = 0; i < inRects.size(); i++) { + for (size_t i = 0; i < inRects.size(); i++) { RotatedRect roi_rect = inRects[i]; float r = (float)roi_rect.size.width / (float)roi_rect.size.height; @@ -869,7 +869,7 @@ int CPlateLocate::deskewOld(Mat src, vector& inRects, vector& outRects, vector& outMats, LocateType locateType) { int k = 1; - for (int i = 0; i < inRects.size(); i++) { + for (size_t i = 0; i < inRects.size(); i++) { RotatedRect minRect = inRects[i]; if (verifySizes(minRect)) { @@ -1048,7 +1048,7 @@ int CPlateLocate::plateColorLocate(Mat src, vector& candPlates, colorSearch(src, YELLOW, src_b, rects_color_yellow, index); deskew(src, src_b, rects_color_yellow, plates); - for (int i = 0; i < plates.size(); i++) { + for (size_t i = 0; i < plates.size(); i++) { candPlates.push_back(plates[i]); } return 0; @@ -1119,7 +1119,7 @@ int CPlateLocate::plateSobelLocate(Mat src, vector& candPlates, vector> bound_rects_part; //对不符合要求的区域进行扩展 - for (int i = 0; i < bound_rects.size(); i++) { + for (size_t i = 0; i < bound_rects.size(); i++) { double fRatio = bound_rects[i].width * 1.0 / bound_rects[i].height; if (fRatio < 3.0 && fRatio > 1.0 && bound_rects[i].height < 120) { Rect_ itemRect = bound_rects[i]; @@ -1140,7 +1140,7 @@ int CPlateLocate::plateSobelLocate(Mat src, vector& candPlates, } } //对断裂的部分进行二次处理 - for (int i = 0; i < bound_rects_part.size(); i++) { + for (size_t i = 0; i < bound_rects_part.size(); i++) { Rect_ bound_rect = bound_rects_part[i]; Point2f refpoint(bound_rect.x, bound_rect.y); @@ -1159,7 +1159,7 @@ int CPlateLocate::plateSobelLocate(Mat src, vector& candPlates, sobelSecSearchPart(bound_mat, refpoint, rects_sobel); } - for (int i = 0; i < bound_rects.size(); i++) { + for (size_t i = 0; i < bound_rects.size(); i++) { Rect_ bound_rect = bound_rects[i]; Point2f refpoint(bound_rect.x, bound_rect.y); @@ -1185,7 +1185,7 @@ int CPlateLocate::plateSobelLocate(Mat src, vector& candPlates, // 进行抗扭斜处理 deskew(src, src_b, rects_sobel, plates); - for (int i = 0; i < plates.size(); i++) candPlates.push_back(plates[i]); + for (size_t i = 0; i < plates.size(); i++) candPlates.push_back(plates[i]); return 0; } @@ -1477,7 +1477,7 @@ int CPlateLocate::plateLocate(Mat src, vector& resultVec, int index) { } } int k = 1; - for (int i = 0; i < rects.size(); i++) { + for (size_t i = 0; i < rects.size(); i++) { RotatedRect minRect = rects[i]; if (verifySizes(minRect)) { // rotated rectangle drawing diff --git a/src/preprocess/gdts.cpp b/src/preprocess/gdts.cpp index 1516569..5b405d6 100644 --- a/src/preprocess/gdts.cpp +++ b/src/preprocess/gdts.cpp @@ -30,7 +30,7 @@ int generate_gdts() { std::cout << "Begin to prepare generate_gdts!" << std::endl; - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { std::string filepath = files[i].c_str(); std::cout << "------------------" << std::endl; std::cout << filepath << std::endl; diff --git a/src/train/ann_train.cpp b/src/train/ann_train.cpp index a722072..75cc0b7 100644 --- a/src/train/ann_train.cpp +++ b/src/train/ann_train.cpp @@ -117,7 +117,7 @@ int saveTrainData() { auto files = Utils::getFiles(ss.str()); size_t size = files.size(); - for (int j = 0; j < size; j++) { + for (size_t j = 0; j < size; j++) { cout << files[j].c_str() << endl; Mat img = imread(files[j].c_str(), 0); Mat f5 = features(img, 5);