diff --git a/EasyPR.sln b/EasyPR.sln index 20e6a4a..bed40e9 100644 --- a/EasyPR.sln +++ b/EasyPR.sln @@ -35,7 +35,4 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection EndGlobal diff --git a/include/easypr/config.h b/include/easypr/config.h index b07554d..0a0fcc2 100644 --- a/include/easypr/config.h +++ b/include/easypr/config.h @@ -26,6 +26,12 @@ typedef enum { kInverse = 0 // correspond to "no plate" } SvmLabel; +static const int kPlateResizeWidth = 136; +static const int kPlateResizeHeight = 36; + +static const int kShowWindowWidth = 800; +static const int kShowWindowHeight = 600; + static const float kSvmPercentage = 0.7f; static const int kCharacterInput = 120; diff --git a/include/easypr/core/plate_detect.h b/include/easypr/core/plate_detect.h index b58c00b..203380f 100644 --- a/include/easypr/core/plate_detect.h +++ b/include/easypr/core/plate_detect.h @@ -37,7 +37,7 @@ class CPlateDetect { */ int plateDetect(Mat src, std::vector &resultVec, int img_index = 0); - int showResult(const Mat &result, int img_index = 0); + Mat showResult(const Mat &result, int img_index = 0); void LoadSVM(std::string s); diff --git a/include/easypr/core/plate_recognize.h b/include/easypr/core/plate_recognize.h index 6d53c2c..e7a6db2 100644 --- a/include/easypr/core/plate_recognize.h +++ b/include/easypr/core/plate_recognize.h @@ -24,8 +24,9 @@ namespace easypr { public: CPlateRecognize(); - int plateRecognize(Mat src, std::vector &licenseVec, int img_index = 0); + int plateRecognize(Mat src, std::vector &plateVec, int img_index = 0); int plateRecognize(Mat src, std::vector &licenseVec); + int plateRecognize(Mat src, std::vector &plateVec, int img_index, Mat& output, const vector& plateVecGT); int plateRecognizeAsText(Mat src, std::vector &licenseVec); int plateRecognizeAsTextNM(Mat src, std::vector &licenseVec); diff --git a/resources/doc/res/one_image_detect.jpg b/resources/doc/res/one_image_detect.jpg new file mode 100644 index 0000000..6c191a1 Binary files /dev/null and b/resources/doc/res/one_image_detect.jpg differ diff --git a/resources/image/general_test/GroundTruth.xml b/resources/image/general_test/GroundTruth.xml index c9177a4..c24289a 100644 --- a/resources/image/general_test/GroundTruth.xml +++ b/resources/image/general_test/GroundTruth.xml @@ -47,7 +47,7 @@ A88888 - :A88888 + :A88888 @@ -65,7 +65,7 @@ AL0Q87 - :AL0Q87 + :AL0Q87 @@ -922,7 +922,7 @@ B901BF - :B901BF + :B901BF @@ -1274,29 +1274,29 @@ :A095Q5 - + A105LR - :A105LR + :A105LR A113YP - :A113YP + :A113YP A561WP - :A561WP + :A561WP A572F4 - :A572F4 + :A572F4 @@ -1308,13 +1308,13 @@ AE8H60 - :AE8H60 + :AE8H60 AGU052 - :AGU052 + :AGU052 @@ -1326,7 +1326,7 @@ AKM065 - :AKM065 + :AKM065 @@ -1350,7 +1350,7 @@ AR9X49 - :AR9X49 + :AR9X49 @@ -1368,7 +1368,7 @@ AY116F - :AY116F + :AY116F @@ -1398,7 +1398,7 @@ B683J8 - :B683J8 + :B683J8 @@ -1416,9 +1416,9 @@ L11921 - :L11921 + :L11921 - + L66736 @@ -1434,7 +1434,7 @@ BE7773 - :BE7773 + :BE7773 @@ -1483,7 +1483,7 @@ BA103N - :BA103N + :BA103N @@ -1507,7 +1507,7 @@ X30479 - :X30479 + :X30479 @@ -1525,7 +1525,7 @@ A66U71 - :A66U71 + :A66U71 @@ -1549,7 +1549,7 @@ AVW997 - :AVW997 + :AVW997 :ANC818 @@ -1571,4 +1571,34 @@ :CPB592 + + AA3610 + + :AA3610 + + + + A2F560 + + :A2F560 + + + + PC5U22 + + :PC5U22 + + + + CXE592 + + :CXE592 + + + + BG0D80 + + :BG0D80 + + diff --git a/resources/image/1.jpg b/resources/image/general_test/京PC5U22.jpg similarity index 100% rename from resources/image/1.jpg rename to resources/image/general_test/京PC5U22.jpg diff --git a/resources/image/extreme_test/不确定/皖A2F560.jpg b/resources/image/general_test/皖A2F560.jpg similarity index 100% rename from resources/image/extreme_test/不确定/皖A2F560.jpg rename to resources/image/general_test/皖A2F560.jpg diff --git a/resources/image/extreme_test/不确定/皖AA3610.jpg b/resources/image/general_test/皖AA3610.jpg similarity index 100% rename from resources/image/extreme_test/不确定/皖AA3610.jpg rename to resources/image/general_test/皖AA3610.jpg diff --git a/resources/image/general_test/粤AK9331 .JPG b/resources/image/general_test/粤AK9331.jpg similarity index 100% rename from resources/image/general_test/粤AK9331 .JPG rename to resources/image/general_test/粤AK9331.jpg diff --git a/resources/image/6.jpg b/resources/image/general_test/粤CXE592.jpg similarity index 100% rename from resources/image/6.jpg rename to resources/image/general_test/粤CXE592.jpg diff --git a/resources/image/7.jpg b/resources/image/general_test/辽BG0D80.jpg similarity index 100% rename from resources/image/7.jpg rename to resources/image/general_test/辽BG0D80.jpg diff --git a/resources/image/general_test/闽CPB593.jpg b/resources/image/general_test/闽CPB592.jpg similarity index 100% rename from resources/image/general_test/闽CPB593.jpg rename to resources/image/general_test/闽CPB592.jpg diff --git a/resources/image/test.jpg b/resources/image/test.jpg deleted file mode 100644 index 26c88d3..0000000 Binary files a/resources/image/test.jpg and /dev/null differ diff --git a/result/GroundTruth.xml b/result/GroundTruth.xml index 5eb38db..befee3a 100644 --- a/result/GroundTruth.xml +++ b/result/GroundTruth.xml @@ -47,7 +47,7 @@ A88888 - :A88888 + :A88888 @@ -65,7 +65,7 @@ AL0Q87 - :AL0Q87 + :AL0Q87 @@ -922,7 +922,7 @@ B901BF - :B901BF + :B901BF @@ -1263,4 +1263,312 @@ :AB4444 + + FK5358 + + :FK5358 + + + + A095Q5 + + :A095Q5 + + + + A105LR + + :A105LR + + + + A113YP + + :A113YP + + + + A561WP + + :A561WP + + + + A572F4 + + :A572F4 + + + + A762ZS + + :A762ZS + + + + AE8H60 + + :AE8H60 + + + + AGU052 + + :AGU052 + + + + AGU801 + + :AGU801 + + + + AKM065 + + :AKM065 + + + + AKQ291 + + :AKQ291 + + + + AM1186 + + :AM1186 + + + + AN4E10 + + :AN4E10 + + + + AR9X49 + + :AR9X49 + + + + AS9V79 + + :AS9V79 + + + + AUU093 + + :AUU093 + + + + AY116F + + :AY116F + + + + AZ408T + + :AZ408T + + + + R35779 + + :R35779 + + + + ATK071 + + :ATK071 + + + + ALB022 + + :ALB022 + + + + B683J8 + + :B683J8 + + + + D71603 + + :D71603 + + + + E6686V + + :E6686V + + + + L11921 + + :L11921 + + + + L66736 + + :L66736 + + + + B777C9 + + :B777C9 + + + + BE7773 + + :BE7773 + + + + A26M71 + + :A26M71 + + + + C01701 + + :C01701 + + + + A82349 + + :A82349 + + + + A961F3 + + :A961F3 + + + + BDB720 + + :BDB720 + + + + A2HQ34 + + :A2HQ34 + :A696L6 + + + + A5DP12 + + :A5DP12 + + + + BA103N + + :BA103N + + + + BE609T + + :BE609T + + + + AB2893 + + :AB2893 + + + + SK903B + + :SK903B + + + + X30479 + + :X30479 + + + + A20Q03 + + :A20Q03 + + + + A36E80 + + :A36E80 + + + + A66U71 + + :A66U71 + + + + AD6A99 + + :AD6A99 + + + + AP0966 + + :AP0966 + + + + AQ5B65 + + :AQ5B65 + + + + AVW997 + + :AVW997 + :ANC818 + + + + ԥU00000 + + :ԥU00000 + + + + K11978 + + :K11978 + + + + CPB592 + + :CPB592 + + diff --git a/result/Result.xml b/result/Result.xml index e7f5f34..cc0fe7a 100644 --- a/result/Result.xml +++ b/result/Result.xml @@ -3,13 +3,13 @@ A88731 - :A88711 + :A88731 BR75Y3 - :BR75Y3 + :BR75Y3 @@ -17,1382 +17,1526 @@ - AA0825 + A961F3 - :PA085 + :A961F3 - AK169H + A31Y83 - :AK169H + :A11R55 + :A31Y83 - A26M71 - - - - A31Y83 + AH8331 - :A3LY83 - :A11R55 + :AH8331 BGG522 - + + :BGG522 + - ATK071 + A26M71 - - + :A26M71 BTT255 - :BTT25L + :BT125 - AAA379 + CX8888 - :AAA39 + :CX8888 - AL025S + ATK071 - CX8888 + BW44R6 - :CX8888 + :BW44R6 - BW44R6 + FK5358 - :BW44R6 + - AS3165 - + AA0825 + + :AA0825 + A50819 - + + :A50879 + - FK5358 - + BU5838 + + :BU5838 + - AAB457 + BZ756T - + :BZ7563 - BZ756T + AJH155 + + + + BZ89M9 - :BZ756T + :BZ89M9 - AT789S + AK169H - :AT789S + :AK169H A54614 - + + :A5A61A + - BU5838 + H99999 - :BU5838 + :H99999 - BZ89M9 + CXE592 A51V39 - + :A51V39 + + + + AAA379 + + :³AAA379 A68952 - + + :A689E2 + - ATH859 + PC5U22 - :ATH859 + A3685C - :QGB86 - :A3685C - :CA962P + :A3685C + :AD7GB8 + :CA9622 - AAC044 + CTF181 - :AAC044 + :CTF181 - H99999 + AL025S - :H9999 + :AL0255 - A72220 + AAB457 + + :AAB457 + + + + AGH092 + + :AGH092 + + + + FA3215 + + :FA3215 + + + + AS3165 + + A72220 + + :Q72220 + + E9R439 - :F9R439 + + :E9R439 - AAD348 + AT789S - :AAD348 + :AT789S - AUB816 + AAC044 - :AUB816 + :AAC044 A88888 - :M88888 + :A88888 - FA3215 + DLA031 - - :AT1203 - :FA3215 + :DLA031 - A95044 - + ALB022 + + :ALB022 + - AAF230 + A95044 - :AAF20 + :Q95044 - AX688A + ATH859 - :FDAX68 - - + :ATH859 - AGH092 + AAD348 - :AGH092 + :AAD348 + - AA2270 - + OA2160 + + :UAZ160 + - CTF181 + A3MA06 - :CTF181 + :A3MA06 + + :AY4936 - OA2160 - + AA2270 + + :ԥMAA227 + - AA4586 + A019W2 - AB288Y - + AP0910 + + :YAP091 + - BBC666 - + E2Y256 + + + - AA5547 - + AUB816 + + :AUB816 + OA9112 - + :0A9112 - A3MA06 + AAF230 - :A3MA06 - - + :³AAF230 - EZM618 + AA4586 - ALB022 - + A095Q5 + + :A095Q5 + - A019W2 + B683J8 - :A019J2 + :8683J8 - AC1847 + E75614 - :AC1847 + :E75614 - F71646 + AA5547 - :FX7164 + :AA5547 OT9048 - :0T90A8 + :T90481 - M12288 - + AX688A + + :AX688A + - AP0910 + A09X20 - :AP0910 + :A09X20 - A095Q5 + EB68W9 - M69311 + AB288Y - :M69311 + :11B288 + :A883J9 + :0Q0100 - SD050L + AC1847 - :SD050L + :AC1847 - A09X20 + D71603 - :A09X20 + :DZ1603 - P77222 + BBC666 - :P77222 + :8BC666 - AM690M + A105LR - :AM690M + :A105LR - A105LR - + A53U19 + + :A53U19 + - A53U19 + SD050L - :A53U19 + :SD050L + :180031 - B683J8 - + EZM618 + + :EZM618 + + + + ԥK91239 + + :ԥK91239 + A113YP - + :ԥA113YP - AB2893 + AM690M + + :AM69UT + + + + F71646 A561WP - + + :A561WP + - D71603 - + AB2893 + + :000100 + :182304 + - Q06417 - + J32500 + + :J32500 + SK903B - + :000100 + :175G2Z + :SK903B - Q0686ѧ + M12288 - A572F4 + ԥS33909 - + :ԥS33909 - DLA031 + A572F4 - :DLA031 - - - + :A572F4 - A5RM87 + M69311 - :A5RM87 + :M69311 - Q15538 + A5RM87 - :Q1553F + :A5RM87 - J32500 + B7C289 - :J3250L + :B7C289 A762ZS - - - - A82M83 - :A82M83 + :A762ZS - Q18632 - - - - A88888 + AF9C00 - :A88888 + :AF9C00 + - AF9C00 + P77222 - - :AF9C00 + :P77222 - Q19917 - - - - Q80197 - - - - AA662F + JS6999 - :AE662F + :JS6999 - A97971 + ԥU00000 - - :A97971 + :Q1LR11 + + TD1291 - :YD1291 + :TD1291 - QA2825 + A82M83 - E2Y256 + C01701 - :E2Y256 + :C01701 - AE8H60 + A88888 + + :A88888 + + + + Q06417 - A2HQ34 + AK9331 - :2HQ34 + :000100 + :175007 VS1866 - :1VVM1V + :VS1866 - JS6999 - + A82F36 + + :A82F36 + :AB148G + + - AEK882 - + AA662F + + :AA662F + + - B7C289 + A97971 + + :A0GT30 + + :A9797 + + + + Q0686ѧ - AGU052 + E6686V - :GU052 + :E6686V - E75614 - + K62933 + + :K62933 + - AGU801 + X30479 - :RSU8Q1 + :7522M6 + - EB68W9 + Q15538 - :B68W91 + :Q15538 - A9NU97 + AL6212 - :A9NU91 - - - :B450LJ + :AL621 - AK9331 + AE8H60 - + :AE8H6D - AKM065 + AEK882 - C01701 - + A0CP56 + + :A0CP56 + - ԥK91239 + KT5583 - + :KT5583 - AKQ291 - + Q18632 + + + - A2TS00 + AV0U41 - - :A2TS00 - + :000100 + :AV0U41 + :75852 - AL0Q87 + AGU052 - :AL0Q81 + :AGU052 - AM1186 + A9NU97 - :Z11VM + :A9NU97 + :B450L1 - AL6212 + A88888 - X30479 + F397C0 - + :F397C0 - ԥS33909 + Q19917 - :ԥS33909 + :Q19917 - AN4E10 + K11978 - AV0U41 + AGU801 - - - :AV0U41 - + :DHU801 - E6686V + A20Q03 - + - AR9X49 - + Q80197 + + :Q80197 + - A9YU86 + B0K999 - :A0PC37 - :A9YU86 - + :B0K999 - AS9V79 - + QA2825 + + :0A2825 + - AUU093 - + B2757B + + :B2757B + - ԥU00000 + F99999 - :U00GQB - :ZR4PVA - + - AY116F + AKM065 - :AY116F + :AKM065 - K62933 + B99999 - :K62933 + + :699999 - A0CP56 + A2HQ34 - :A0CP56 + :A2HQ34 + :1QG8M8 - A5DP12 + B2LR57 - :QMLP1D + :B2LR57 - AZ408T - + G70000 + + + - C28888 + AHP676 - :C28888 + :AHP676 - AA8516 + AKQ291 - :AA8516 - + :AKQ291 - A20Q03 + BG0D80 - + :P5QBW6 - B0K999 + B3RS91 - :B0K999 + :B3RS91 - B2757B - + GZB388 + + :GZB388 + A36E80 - B2LR57 + B4051L - :B2LR57 + :ԥVB4051 - B3RS91 + AL0Q87 - :B3RS91 - + :AL0Q87 - KT5583 + GZJ021 - - + + :GZJ021 - A82F36 + BMW005 - :A82F36 - :AB14B9 + :BMW005 - A66U71 + B577QK - - :Q6611 + :B577QK - A5J512 + A9YU86 - :A5J512 + :A0PC37 + :A9YU86 - B4051L + C33333 - :B4051L + :C33333 - AED855 + JP291Q - - :AED855 + :JP291Q - B577QK - + A2TS00 + + :³180303 + :A2TS00 + - A6E176 - + B5PQ23 + + :B5PQ23 + :ԥ175545 + - A5PJ05 + AM1186 - :A5PJ95 - - + - B5PQ23 + PE9218 - :B5PQ23 + :PE9218 - A88888 + DTG667 - :A88888 + :UTG667 - K11978 + A66U71 - :K1197F + :A66U61 - AL8387 + AN4E10 - :AL8387 - - + :AW4E10 - A75976 + L11921 - :759Z6 + :L11921 - F397C0 + AR9X49 - :F397C0 + :AR9D49 - B99999 + B5W601 - + :17550R + :B5W601 - A85Z95 + CPB592 - :A85Z95 + :CPB593 - BMW005 + A5DP12 - :BMW005 + :000100 + :ԥ180003 + :A5DP11 - C33333 + A6E176 + + + + AS9V79 - A9YP07 + HB1508 - :49YP07 + :HB1508 - B5W601 + AA8516 - - + :AA8516 - AT1Y68 + AD2N68 - :AT1Y68 + :A02N68 - F99999 + E14579 - :F99999 + :E14579 - PE9218 + AUU093 - :PE9218 + :AUU093 - G70000 + B7VW40 - + :B7VW40 - AD6A99 + A5J512 - - :AC6A99 + :A5J512 - GZB388 + L66736 - :GZB388 + - A5Q951 - - - - GZJ021 + AY116F - :GZJ021 + :AY116F - ADW072 - + B901BF + + :B901BF + - A82349 - + A75976 + + :A759Z6 + - AHP676 + B972HL - :GDL171 - :AHP676 + :B972HL - JP291Q + AZ408T - :JP291Q + :MA7408 - CPB593 - + BA103N + + + - AT3597 + A5PJ05 - :AT3597 + :A5PJR5 + :17455T - AHOG66 + C28888 - :AH0G66 + :C28888 - HB1508 + AED855 - :HB1508 + :AED855 + - A84266 + E22602 - :A84266 + :E22602 - AD2N68 + AE8F80 - :A02N68 + :511TAE + :AE8F80 - B7VW40 - + A85Z95 + + :QF11W + :A85Z95 + - B901BF - + BA9H07 + + :BA9H07 + - DTG667 - + LD1930 + + :LD1930 + - A89311 + BB867A - :A8931L + :BB867A - B972HL + A5Q951 - :B972HL + :A50951 - AT8781 + BDB720 - :AT8781 + :BDB720 - L11921 - + ³A88888 + + :A88888 + - BA103N - + A9YP07 + + :A9YP07 + - A94372 + ³B995EQ - :A9A372 + :³B995EQ - AL926V + E24494 - :AL926V + :E24494 - BA9H07 + ³BQG527 - :BA9H07 + - BB867A + AL8387 - :BB867A + :AL8387 - AP0966 - + A82349 + + :A82349 + - A961F3 - + BE24Q7 + + :BE24Q7 + - E14579 + B3587ѧ - :E14579 + :R3587 - BDB720 - + ³JRW350 + + :³JRW350 + - AE8F80 + BE609T - L66736 + ³KK5555 - :L66736 + :KK5555 - ATL269 + A84266 - :ATL269 - + :ԥA84266 - BE24Q7 + AD6A99 - :BE24Q7 + :AD6A99 - AQ5B65 + ³LD9016 - - - + :LD9016 - BE609T + B777C9 - ³A88888 + BK33E3 - E22602 + ³Y44748 - :E22602 + :³Y44748 - ³B995EQ + E28437 - :³B995EQ + :E28437 + :G1L92 - BK33E3 + BP3T05 - :BK33E3 + :BP3T05 - LD1930 + A16341 - :LD1930 + :A11634 - ³BQG527 + A1R272 - :³BQG527 + :QR272 - BP3T05 + BE7773 - :BP3T05 + :6E77Z3 + - ³JRW350 - + A89311 + + :³A89311 + - AYN355 + AT1Y68 - :AYN355 + :AT1Y68 - ³KK5555 + ADW072 - :³KK5555 + :ADW072 - ³LD9016 + AB4444 - :LD9016 + :AB4444 + - ³Y44748 + G68991 - :³Y44748 + :G68991 + :MRW366 - E24494 + A94372 - :E24494 + :A9A372 - A16341 + A05H22 - :AY1634 + :A05H22 + - B3587ѧ + AT3597 - :63587L + :AT3597 + - A1R272 + AHOG66 - :A1R272 + :AH0G66 - F8ZS83 + H65817 - - - - + :1H6581 - B777C9 + A07G31 - + + :1A11R5 - E28437 + AL926V - :GTL921 - :E28437 + :AL926V - AB4444 + JZ3999 - BE7773 + AT8781 - :ԥYXQ3Z7 + :AT8781 - A05H22 + AP0966 - - + :AP0966 - G68991 + KNG518 - :G68991 + :KNG518 - AVW997 - - - - H65817 + A0PC37 - :H65817 + :A0PC37 + :QAJW53 - A07G31 + ATL269 - - :A11R55 + :31Y83 + :ATL269 - B551QV + AQ5B65 - :B551QV + :AQ5B65 - JZ3999 + LS2999 + + + + A0PQ76 - :E24494 + + - B577CU + AVW997 - :B577CU + :ANJ997 + - A0PC37 + AYN355 - :A0PC37 - :AJW53 + :AYN355 + :KL689 - KNG518 + MJY929 - :KNG518 - :AHP676 + :ԥZMST61 + :MJY929 - A0PQ76 + B551QV - + :B551QV - LS2999 - + F8ZS83 + + :8ZS83V + :1R8041 + :DDMDD + + A2991D - :A2991D - + :AQK103 + :A2991D - - MJY929 - - MN0888 - :MN0888 + :MN0888 - NRL118 + B577CU - :NRL118 - + :B577CU G60009 - :G60009 + :G6000 GR0L16 - :GR0L16 - + :GR0L16 - RB7992 + NRL118 - - :RB7992 + :NRL118 A00T45 - + + + - A09T87 - + RB7992 + + :017HYV + :RB7992 + - A03168 - + A09T87 + + :A09T87 + A1T235 - :A1T235 + A22T43 - :A22143 + :A22143 - A12210 - + A03168 + + :A03168 + - A12903 + A2F560 + + A12210 + + :3A1221 + + A30123 - :A30123 + :A30123 - A13840 + A12903 - :DETV3 + :A12903 - A21027 - + A13840 + + :6A1384 + A45277 - A80003 - + A21027 + + :A21097 + - A80375 + A80003 - :A8037Q + :A80003 + + A80375 + + A85501 - :A85501 + :A85501 A85890 - :A85890 + :A85890 A87271 - :A87271 + :A87271 - AH8331 - - - - AJH155 - + AA3610 + + :AA3610 + diff --git a/result/accuracy.txt b/result/accuracy.txt index ab8c294..ff022a2 100644 --- a/result/accuracy.txt +++ b/result/accuracy.txt @@ -1878,3 +1878,48 @@ Recall:74.6006%, Precise:76.6991%, Fscore:75.6353%. Recall:74.6368%, Precise:76.991%, Fscore:75.7956%. 0-error:60.3604%, 1-error:69.3694%, Chinese-precise:72.5225% ʱ:319, ƽִʱ:1.27092 +2016-07-05 08:54:24 +ͼƬ:251, Plates count:290, δλ:49, λ:83.1034% +Recall:74.6368%, Precise:76.991%, Fscore:75.7956%. +0-error:60.3604%, 1-error:69.3694%, Chinese-precise:72.5225% +ʱ:1108, ƽִʱ:4.41434 +2016-07-05 09:54:29 +ͼƬ:251, Plates count:291, δλ:48, λ:83.5052% +Recall:75.4744%, Precise:78.1189%, Fscore:76.7739%. +0-error:60.2679%, 1-error:69.1964%, Chinese-precise:72.3214% +ʱ:1694, ƽִʱ:6.749 +2016-07-05 09:55:22 +ͼƬ:1, Plates count:0, δλ:0, λ:-1.#IND% +Recall:0%, Precise:0%, Fscore:0%. +0-error:0%, 1-error:0%, Chinese-precise:100% +ʱ:2, ƽִʱ:2 +2016-07-05 09:55:43 +ͼƬ:1, Plates count:1, δλ:1, λ:0% +Recall:0%, Precise:0%, Fscore:0%. +0-error:0%, 1-error:0%, Chinese-precise:100% +ʱ:2, ƽִʱ:2 +2016-07-05 10:03:58 +ͼƬ:2, Plates count:2, δλ:1, λ:50% +Recall:45.3786%, Precise:90.7571%, Fscore:60.5048%. +0-error:0%, 1-error:0%, Chinese-precise:0% +ʱ:7, ƽִʱ:3.5 +2016-07-05 10:05:49 +ͼƬ:3, Plates count:0, δλ:0, λ:-1.#IND% +Recall:0%, Precise:0%, Fscore:0%. +0-error:0%, 1-error:0%, Chinese-precise:100% +ʱ:16, ƽִʱ:5.33333 +2016-07-05 10:12:30 +ͼƬ:3, Plates count:3, δλ:1, λ:66.6667% +Recall:65.3067%, Precise:97.96%, Fscore:78.368%. +0-error:0%, 1-error:0%, Chinese-precise:0% +ʱ:7, ƽִʱ:2.33333 +2016-07-05 10:16:09 +ͼƬ:256, Plates count:297, δλ:51, λ:82.8283% +Recall:74.9149%, Precise:78.3019%, Fscore:76.5709%. +0-error:59.7345%, 1-error:68.5841%, Chinese-precise:71.6814% +ʱ:86, ƽִʱ:0.335938 +2016-07-05 11:49:45 +ͼƬ:256, Plates count:297, δλ:51, λ:82.8283% +Recall:74.9149%, Precise:78.3019%, Fscore:76.5709%. +0-error:59.7345%, 1-error:68.5841%, Chinese-precise:71.6814% +ʱ:95, ƽִʱ:0.371094 diff --git a/src/core/core_func.cpp b/src/core/core_func.cpp index 19f27a6..e6e30d8 100644 --- a/src/core/core_func.cpp +++ b/src/core/core_func.cpp @@ -2079,7 +2079,7 @@ void mserCharMatch(const Mat &src, std::vector &match, std::vector& destroyWindow("match"); } - if (0) { + if (1) { std::stringstream ss(std::stringstream::in | std::stringstream::out); ss << "resources/image/tmp/plateDetect/plate_" << img_index << "_" << the_color << ".jpg"; imwrite(ss.str(), result); diff --git a/src/core/plate_detect.cpp b/src/core/plate_detect.cpp index 9e2134e..7ec7494 100644 --- a/src/core/plate_detect.cpp +++ b/src/core/plate_detect.cpp @@ -1,5 +1,6 @@ #include "easypr/core/plate_detect.h" #include "easypr/util/util.h" +#include "easypr/config.h" namespace easypr { @@ -122,6 +123,7 @@ namespace easypr { return 0; } + int CPlateDetect::plateDetect(Mat src, std::vector &resultVec, int img_index) { int result = plateDetect(src, resultVec, m_type, false, img_index); return result; @@ -131,11 +133,12 @@ namespace easypr { PlateJudge::instance()->LoadModel(path); } - int CPlateDetect::showResult(const Mat &result, int img_index) { + + Mat CPlateDetect::showResult(const Mat &result, int img_index) { namedWindow("EasyPR", CV_WINDOW_AUTOSIZE); - const int RESULTWIDTH = 640; // 640 930 - const int RESULTHEIGHT = 540; // 540 710 + const int RESULTWIDTH = kShowWindowWidth; // 640 930 + const int RESULTHEIGHT = kShowWindowHeight; // 540 710 Mat img_window; img_window.create(RESULTHEIGHT, RESULTWIDTH, CV_8UC3); @@ -192,6 +195,6 @@ namespace easypr { imwrite(ss.str(), img_window); } - return 0; + return img_window; } } \ No newline at end of file diff --git a/src/core/plate_recognize.cpp b/src/core/plate_recognize.cpp index 0f558b5..e625a40 100644 --- a/src/core/plate_recognize.cpp +++ b/src/core/plate_recognize.cpp @@ -118,7 +118,7 @@ int CPlateRecognize::plateRecognizeAsText(Mat src, std::vector &licenseV } -int CPlateRecognize::plateRecognize(Mat src, std::vector &licenseVec, int img_index) { +int CPlateRecognize::plateRecognize(Mat src, std::vector &plateVecOut, int img_index, Mat& output, const vector& plateVecGT) { std::vector plateVec; @@ -155,12 +155,110 @@ int CPlateRecognize::plateRecognize(Mat src, std::vector &licenseVec, in if (resultCR == 0) { std::string license = plateColor + ":" + plateIdentify; item.setPlateStr(license); - licenseVec.push_back(item); + plateVecOut.push_back(item); } else { std::string license = plateColor; item.setPlateStr(license); - licenseVec.push_back(item); + plateVecOut.push_back(item); + if (0) { + std::cout << "resultCR:" << resultCR << std::endl; + } + } + } + + if (getResultShow()) { + Mat result; + src.copyTo(result); + + for (size_t j = 0; j < num; j++) { + CPlate item = plateVec[j]; + Mat plateMat = item.getPlateMat(); + + int height = 36; + int width = 136; + if (height * index + height < result.rows) { + Mat imageRoi = result(Rect(0, 0 + height * index, width, height)); + addWeighted(imageRoi, 0, plateMat, 1, 0, imageRoi); + } + index++; + + RotatedRect minRect = item.getPlatePos(); + Point2f rect_points[4]; + minRect.points(rect_points); + + Scalar lineColor = Scalar(255, 255, 255); + + if (item.getPlateLocateType() == SOBEL) lineColor = Scalar(255, 0, 0); + if (item.getPlateLocateType() == COLOR) lineColor = Scalar(0, 255, 0); + if (item.getPlateLocateType() == CMSER) lineColor = Scalar(0, 0, 255); + + for (int j = 0; j < 4; j++) + line(result, rect_points[j], rect_points[(j + 1) % 4], lineColor, 2, 8); + } + + for (auto plateG : plateVecGT) { + RotatedRect minRect = plateG.getPlatePos(); + Point2f rect_points[4]; + minRect.points(rect_points); + + Scalar lineColor = Scalar(255, 255, 255); + + for (int j = 0; j < 4; j++) + line(result, rect_points[j], rect_points[(j + 1) % 4], lineColor, 2, 8); + } + + output = showResult(result); + } + } + + + return resultPD; +} + +int CPlateRecognize::plateRecognize(Mat src, std::vector &plateVecOut, int img_index) { + + std::vector plateVec; + + int resultPD = plateDetect(src, plateVec, img_index); + + if (resultPD == 0) { + size_t num = plateVec.size(); + int index = 0; + + for (size_t j = 0; j < num; j++) { + CPlate item = plateVec.at(j); + Mat plateMat = item.getPlateMat(); + + if (0) { + imshow("plate", plateMat); + waitKey(0); + destroyWindow("plate"); + } + + Color color = item.getPlateColor(); + if (color == UNKNOWN) { + color = getPlateType(plateMat, true); + item.setPlateColor(color); + } + + std::string plateColor = getPlateColor(color); + if (0) { + std::cout << "plateColor:" << plateColor << std::endl; + } + + std::string plateIdentify = ""; + int resultCR = charsRecognise(item, plateIdentify); + + if (resultCR == 0) { + std::string license = plateColor + ":" + plateIdentify; + item.setPlateStr(license); + plateVecOut.push_back(item); + } + else { + std::string license = plateColor; + item.setPlateStr(license); + plateVecOut.push_back(item); if (0) { std::cout << "resultCR:" << resultCR << std::endl; } @@ -200,6 +298,8 @@ int CPlateRecognize::plateRecognize(Mat src, std::vector &licenseVec, in showResult(result); } } + + return resultPD; } @@ -263,8 +363,8 @@ int CPlateRecognize::plateRecognize(Mat src, std::vector &licenseVe Scalar lineColor = Scalar(255, 255, 255); if (item.getPlateLocateType() == SOBEL) lineColor = Scalar(255, 0, 0); - if (item.getPlateLocateType() == COLOR) lineColor = Scalar(0, 255, 0); + if (item.getPlateLocateType() == CMSER) lineColor = Scalar(0, 0, 255); for (int j = 0; j < 4; j++) line(result, rect_points[j], rect_points[(j + 1) % 4], lineColor, 2, diff --git a/test/accuracy.hpp b/test/accuracy.hpp index 947811a..2e81de6 100644 --- a/test/accuracy.hpp +++ b/test/accuracy.hpp @@ -158,14 +158,11 @@ namespace easypr { img_ss << kv->get("original_plate") << ":" << plateLicense << endl; // remain - //XMLNode xNode, rectangleNodes; - //xNode = xMainNode.addChild("image"); - //xNode.addChild("imageName").addText(plateLicense.c_str()); - //rectangleNodes = xNode.addChild("taggedRectangles"); + XMLNode xNode, rectangleNodes; + xNode = xMainNode.addChild("image"); + xNode.addChild("imageName").addText(plateLicense.c_str()); + rectangleNodes = xNode.addChild("taggedRectangles"); - vector plateVec; - int result = pr.plateRecognize(src, plateVec, i); - // get the ground truth and compare it with the detect list; vector plateVecGT; #pragma omp critical @@ -179,6 +176,10 @@ namespace easypr { img_ss << "No ground truth found!" << endl; } } + + vector plateVec; + Mat output; + int result = pr.plateRecognize(src, plateVec, i, output, plateVecGT); for (auto plate_g : plateVecGT) { float bestmatch = 0.f; @@ -269,18 +270,18 @@ namespace easypr { calcSafeRect(platePos_d, src, plateRect_d); // remain - //XMLNode rectangleNode = rectangleNodes.addChild("taggedRectangle"); - //RotatedRect rr = platePos_d; - //LocateType locateType = plate_d.getPlateLocateType(); + XMLNode rectangleNode = rectangleNodes.addChild("taggedRectangle"); + RotatedRect rr = platePos_d; + LocateType locateType = plate_d.getPlateLocateType(); - //rectangleNode.addAttribute("x", to_string((int)rr.center.x).c_str()); - //rectangleNode.addAttribute("y", to_string((int)rr.center.y).c_str()); - //rectangleNode.addAttribute("width", to_string((int)rr.size.width).c_str()); - //rectangleNode.addAttribute("height", to_string((int)rr.size.height).c_str()); + rectangleNode.addAttribute("x", to_string((int)rr.center.x).c_str()); + rectangleNode.addAttribute("y", to_string((int)rr.center.y).c_str()); + rectangleNode.addAttribute("width", to_string((int)rr.size.width).c_str()); + rectangleNode.addAttribute("height", to_string((int)rr.size.height).c_str()); - //rectangleNode.addAttribute("rotation", to_string((int)rr.angle).c_str()); - //rectangleNode.addAttribute("locateType", to_string(locateType).c_str()); - //rectangleNode.addText(plate_d.getPlateStr().c_str()); + rectangleNode.addAttribute("rotation", to_string((int)rr.angle).c_str()); + rectangleNode.addAttribute("locateType", to_string(locateType).c_str()); + rectangleNode.addText(plate_d.getPlateStr().c_str()); for (auto plate_g : plateVecGT) { RotatedRect platePos_g = plate_g.getPlatePos(); @@ -348,7 +349,7 @@ namespace easypr { time(&end); // the xml detection result - // xMainNode.writeToFile(path_result.c_str()); + xMainNode.writeToFile(path_result.c_str()); cout << "------------------" << endl; cout << "Easypr accuracy test end!" << endl; diff --git a/vcprojs/demo.vcxproj b/vcprojs/demo.vcxproj index 29a57cb..31680e3 100644 --- a/vcprojs/demo.vcxproj +++ b/vcprojs/demo.vcxproj @@ -91,7 +91,7 @@ WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) $(OPENCV)\include;$(SolutionDir)include;$(SolutionDir) 4819 - false + true Console