#include "config.h" #include #define VNAME(value) (#value) namespace graft_cv{ CGCvConfig::CGCvConfig() :m_cparam(0) { }; CGCvConfig::~CGCvConfig() { }; void CGCvConfig::setConfParam(ConfigParam*cp) { m_cparam = cp; } void CGCvConfig::write(cv::FileStorage &fs)const{ assert(m_cparam!=0); fs << "{" << "image_show"<< m_cparam->image_show << "image_return"<< m_cparam->image_return <<"image_save"<image_save <<"image_depository"<image_depository <<"image_backup_days"<image_backup_days <<"model_path_grab"<model_path_grab <<"object_threshold_grab"<object_threshold_grab <<"nms_threshold_grab"<nms_threshold_grab << "model_path_cut" << m_cparam->model_path_cut << "object_threshold_cut" << m_cparam->object_threshold_cut << "nms_threshold_cut" << m_cparam->nms_threshold_cut << "}"; }; void CGCvConfig::read(const cv::FileNode& node){ //Read serialization for this class assert(m_cparam!=0); m_cparam->image_show = (bool)(int)node["image_show"]; m_cparam->image_return = (bool)(int)node["image_return"]; m_cparam->image_save = (bool)(int)node["image_save"]; m_cparam->image_depository =(string)node["image_depository"]; m_cparam->image_backup_days = (int)node["image_backup_days"]; m_cparam->model_path_grab =(string)node["model_path_grab"]; m_cparam->object_threshold_grab = (float)node["object_threshold_grab"]; m_cparam->nms_threshold_grab = (float)node["nms_threshold_grab"]; m_cparam->model_path_cut = (string)node["model_path_cut"]; m_cparam->object_threshold_cut = (float)node["object_threshold_cut"]; m_cparam->nms_threshold_cut = (float)node["nms_threshold_cut"]; } string get_cparam_info(ConfigParam*m_cparam) { if(!m_cparam){return string("");} stringstream buff; buff << "{" <image_show << endl << "image_return:\t"<< m_cparam->image_return << endl <<"image_save:\t"<image_save << endl <<"image_depository:\t"<image_depository << endl <<"image_backup_days:\t"<image_backup_days << endl <<"model_path_grab:\t"<model_path_grab << endl <<"object_threshold_grab:\t"<object_threshold_grab << endl <<"nms_threshold_grab:\t"<nms_threshold_grab << endl << "model_path_cut:\t" << m_cparam->model_path_cut << endl << "object_threshold_cut:\t" << m_cparam->object_threshold_cut << endl << "nms_threshold_cut:\t" << m_cparam->nms_threshold_cut << endl << "}" << endl; return buff.str(); } }