update 解决warning

dev_lsy
xiewenji 1 week ago
parent 50e9883a79
commit ef7793736e

@ -64,6 +64,12 @@ public:
static int cutSmallImg(cv::Mat img, std::vector<cv::Rect> &samllRoiList, cv::Rect config_roi, int config_SmallImg_Width, int config_SmallImg_Height, int config_MinOverlap_Width, int config_MinOverlap_Height); static int cutSmallImg(cv::Mat img, std::vector<cv::Rect> &samllRoiList, cv::Rect config_roi, int config_SmallImg_Width, int config_SmallImg_Height, int config_MinOverlap_Width, int config_MinOverlap_Height);
static cv::Point2f transformPoint(const cv::Point2f &point, const cv::Mat &transform_matrix); static cv::Point2f transformPoint(const cv::Point2f &point, const cv::Mat &transform_matrix);
}; };
// 无参数重载:直接返回原字符串,避免 -Wformat-security 警告
static inline std::string str_Format(const std::string &format)
{
return format;
}
template <typename... Args> template <typename... Args>
static std::string str_Format(const std::string &format, Args... args) static std::string str_Format(const std::string &format, Args... args)
{ {

@ -25,6 +25,12 @@ enum PrintLevel_
PrintLevel_3, PrintLevel_3,
PrintLevel_4, PrintLevel_4,
}; };
// 无参数重载:直接返回原字符串,避免 -Wformat-security 警告
inline std::string str_Format_1(const std::string &format)
{
return format;
}
template <typename... Args> template <typename... Args>
std::string str_Format_1(const std::string &format, Args... args) std::string str_Format_1(const std::string &format, Args... args)
{ {

@ -96,6 +96,9 @@ string JudgeMaterialPosition(Mat img) {
} else if (left_black_count > right_black_count) { } else if (left_black_count > right_black_count) {
return "Right"; return "Right";
} }
else{
return "Unknown";
}
} }
//正常情况CAimg物料在左img_B物料在右TAimg物料在右img_B物料在左 //正常情况CAimg物料在左img_B物料在右TAimg物料在右img_B物料在左

@ -113,14 +113,15 @@ int ReadFlawCodeConfig(std::string json_path)
int ConfigManager::LoadParamConfig(std::shared_ptr<ConfigBase> &Config, std::string strConfigPath) int ConfigManager::LoadParamConfig(std::shared_ptr<ConfigBase> &Config, std::string strConfigPath)
{ {
Json::Reader json_reader; Json::CharReaderBuilder builder;
Json::Value json_value; Json::Value json_value;
std::string errs;
std::ifstream infile(strConfigPath, ios::binary); std::ifstream infile(strConfigPath, ios::binary);
printf("Analysis_Config_path========== %s \n", strConfigPath.c_str()); printf("Analysis_Config_path========== %s \n", strConfigPath.c_str());
// getchar(); // getchar();
if (infile.is_open()) if (infile.is_open())
{ {
if (json_reader.parse(infile, json_value)) if (Json::parseFromStream(builder, infile, &json_value, &errs))
{ {
Config->UpdateJSONConfig((void *)&json_value, ConfigType_Analysisy_Common_XL); Config->UpdateJSONConfig((void *)&json_value, ConfigType_Analysisy_Common_XL);

@ -432,7 +432,7 @@ int deal::preCheck()
} }
if (dfe.m_product_Camera_List.size() <= 0) if (dfe.m_product_Camera_List.size() <= 0)
{ {
printf("error m_product_Camera_List.size() %d \n", dfe.m_product_Camera_List.size()); printf("error m_product_Camera_List.size() %ld \n", dfe.m_product_Camera_List.size());
return -1; return -1;
} }
int idx = 0; int idx = 0;

Loading…
Cancel
Save