Fetch the repository succeeded.
api.hpp 15行
static bool plate_judge(const char* image, const char* model) {
cv::Mat src = cv::imread(image);
assert(!src.empty());
int result;
PlateJudge::instance()->plateJudge(src, result);
return result == 1;
}
api.hpp 40行
static std::vector<std::string> plate_recognize(const char* image,
const char* model_svm,
const char* model_ann,
const bool life_mode = true) {
cv::Mat img = cv::imread(image);
assert(!img.empty());
CPlateRecognize pr;
pr.setLifemode(life_mode);
pr.setDebug(false);
std::vector<std::string> results;
pr.plateRecognize(img, results);
return std::move(results);
}
搞了半天发现根本就没有设置模型的位置,私有成员暂时还没有开放
class PlateJudge {
public:
static PlateJudge* instance();
//! 对多幅车牌进行SVM判断
int plateJudge(const std::vector<CPlate>&, std::vector<CPlate>&);
//! 车牌判断
int plateJudge(const std::vector<Mat>&, std::vector<Mat>&);
//! 车牌判断(一副图像)
int plateJudge(const Mat& inMat, int& result);
private:
PlateJudge();
static PlateJudge* instance_;
cv::Ptr<ml::SVM> svm_;
};
实现文件:
PlateJudge::PlateJudge() { svm_ = ml::SVM::load<ml::SVM>(kDefaultSvmPath); }
字符识别类似。都是使用了静态实例,防止模型被反复加载,不过感觉还是应该开放模型重新设置的功能。
Sign in to comment