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.

PlateSegmentation.h 1.2 kB

4 years ago
1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef HYPERPR_PLATESEGMENTATION_H
  2. #define HYPERPR_PLATESEGMENTATION_H
  3. #include "PlateInfo.h"
  4. #include "opencv2/opencv.hpp"
  5. #include <opencv2/dnn.hpp>
  6. namespace pr {
  7. class PlateSegmentation {
  8. public:
  9. const int PLATE_NORMAL = 6;
  10. const int PLATE_NORMAL_GREEN = 7;
  11. const int DEFAULT_WIDTH = 20;
  12. PlateSegmentation(std::string phototxt, std::string caffemodel);
  13. PlateSegmentation() {}
  14. void segmentPlatePipline(PlateInfo &plateInfo, int stride,
  15. std::vector<cv::Rect> &Char_rects);
  16. void segmentPlateBySlidingWindows(cv::Mat &plateImage, int windowsWidth,
  17. int stride, cv::Mat &respones);
  18. void templateMatchFinding(const cv::Mat &respones, int windowsWidth,
  19. std::pair<float, std::vector<int>> &candidatePts);
  20. void refineRegion(cv::Mat &plateImage, const std::vector<int> &candidatePts,
  21. const int padding, std::vector<cv::Rect> &rects);
  22. void ExtractRegions(PlateInfo &plateInfo, std::vector<cv::Rect> &rects);
  23. cv::Mat classifyResponse(const cv::Mat &cropped);
  24. private:
  25. cv::dnn::Net net;
  26. };
  27. } // namespace pr
  28. #endif // HYPERPR_PLATESEGMENTATION_H