You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_segmentation.cpp 1.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // Created by Jack Yu on 16/10/2017.
  3. //
  4. #include "../include/PlateSegmentation.h"
  5. #include "../include/CNNRecognizer.h"
  6. #include "../include/Recognizer.h"
  7. std::vector<std::string> chars{"京","沪","津","渝","冀","晋","蒙","辽","吉","黑","苏","浙","皖","闽","赣","鲁","豫","鄂","湘","粤","桂","琼","川","贵","云","藏","陕","甘","青","宁","新","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z"};
  8. void TEST_SLIDINGWINDOWS_EVAL(){
  9. cv::Mat demo = cv::imread("res/cache/finemappingres.png");
  10. cv::resize(demo,demo,cv::Size(136,36));
  11. cv::Mat respones;
  12. pr::PlateSegmentation plateSegmentation("model/Segmentation.prototxt","model/Segmentation.caffemodel");
  13. pr::PlateInfo plate;
  14. plate.setPlateImage(demo);
  15. std::vector<cv::Rect> rects;
  16. plateSegmentation.segmentPlatePipline(plate,1,rects);
  17. plateSegmentation.ExtractRegions(plate,rects);
  18. pr::GeneralRecognizer *recognizer = new pr::CNNRecognizer("model/CharacterRecognization.prototxt","model/CharacterRecognization.caffemodel");
  19. recognizer->SegmentBasedSequenceRecognition(plate);
  20. std::cout<<plate.decodePlateNormal(chars)<<std::endl;
  21. delete(recognizer);
  22. }
  23. int main(){
  24. TEST_SLIDINGWINDOWS_EVAL();
  25. return 0;
  26. }