feat 添加盲失,黑白点过滤参数配置

dev_lsy
liusiyang 1 week ago
parent 87746fc05d
commit e80cae3e60

@ -2374,6 +2374,110 @@ struct Base_Function_AD_Check
} }
}; };
// 盲失检测功能
struct Base_Function_MS_Check
{
bool bOpen; // 是否开启
float MS_IOU; // IOU 阈值(同位置判断)
float MS_Expand; // 扩张值(像素)
std::vector<std::string> ms_main_channel; // 主通道绑定
std::vector<std::string> ms_filter_channels; // 过滤通道绑定
Base_Function_MS_Check()
{
Init();
}
void Init()
{
bOpen = false;
MS_IOU = 0.8f;
MS_Expand = 0.0f;
ms_main_channel.clear();
ms_filter_channels.clear();
}
void copy(Base_Function_MS_Check tem)
{
this->bOpen = tem.bOpen;
this->MS_IOU = tem.MS_IOU;
this->MS_Expand = tem.MS_Expand;
this->ms_main_channel = tem.ms_main_channel;
this->ms_filter_channels = tem.ms_filter_channels;
}
void print(std::string str)
{
printf("%s", GetInfo(str).c_str());
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d MS_IOU %f MS_Expand %f ", str.c_str(), bOpen, MS_IOU, MS_Expand);
std::string str123 = buffer;
for (int i = 0; i < ms_main_channel.size(); i++)
{
str123 += str + ":ms_main_channel " + ms_main_channel.at(i) + ";";
}
for (int i = 0; i < ms_filter_channels.size(); i++)
{
str123 += str + ":ms_filter_channels " + ms_filter_channels.at(i) + ";";
}
str123 += "\n";
return str123;
}
};
// Cell黑白点检测功能
struct Base_Function_CellBW_Check
{
bool bOpen; // 是否开启
float CellBW_IOU; // IOU 阈值(同位置判断)
float CellBW_Expand; // 扩张值(像素)
std::vector<std::string> cellbw_main_channel; // 主通道绑定
std::vector<std::string> cellbw_filter_channels; // 过滤通道绑定
Base_Function_CellBW_Check()
{
Init();
}
void Init()
{
bOpen = false;
CellBW_IOU = 0.8f;
CellBW_Expand = 0.0f;
cellbw_main_channel.clear();
cellbw_filter_channels.clear();
}
void copy(Base_Function_CellBW_Check tem)
{
this->bOpen = tem.bOpen;
this->CellBW_IOU = tem.CellBW_IOU;
this->CellBW_Expand = tem.CellBW_Expand;
this->cellbw_main_channel = tem.cellbw_main_channel;
this->cellbw_filter_channels = tem.cellbw_filter_channels;
}
void print(std::string str)
{
printf("%s", GetInfo(str).c_str());
}
std::string GetInfo(std::string str)
{
char buffer[256];
sprintf(buffer, "%s>>bOpen %d CellBW_IOU %f CellBW_Expand %f ", str.c_str(), bOpen, CellBW_IOU, CellBW_Expand);
std::string str123 = buffer;
for (int i = 0; i < cellbw_main_channel.size(); i++)
{
str123 += str + ":cellbw_main_channel " + cellbw_main_channel.at(i) + ";";
}
for (int i = 0; i < cellbw_filter_channels.size(); i++)
{
str123 += str + ":cellbw_filter_channels " + cellbw_filter_channels.at(i) + ";";
}
str123 += "\n";
return str123;
}
};
// 基础检测功能 // 基础检测功能
struct BaseCheckFunction struct BaseCheckFunction
{ {
@ -2383,6 +2487,8 @@ struct BaseCheckFunction
Base_Function_BigNG bigNG; Base_Function_BigNG bigNG;
Base_Function_EdgeChannel edgeChannel; Base_Function_EdgeChannel edgeChannel;
Base_Function_AD_Check ad_check; Base_Function_AD_Check ad_check;
Base_Function_MS_Check ms_check;
Base_Function_CellBW_Check cellbw_check;
bool bDrawAndSave; // 是否存图绘制(绘制并保存结果图,运行时替代 SAVE_RESIMG 宏) bool bDrawAndSave; // 是否存图绘制(绘制并保存结果图,运行时替代 SAVE_RESIMG 宏)
BaseCheckFunction() BaseCheckFunction()
{ {
@ -2396,6 +2502,8 @@ struct BaseCheckFunction
bigNG.Init(); bigNG.Init();
edgeChannel.Init(); edgeChannel.Init();
ad_check.Init(); ad_check.Init();
ms_check.Init();
cellbw_check.Init();
bDrawAndSave = false; bDrawAndSave = false;
} }
void copy(BaseCheckFunction tem) void copy(BaseCheckFunction tem)
@ -2406,6 +2514,8 @@ struct BaseCheckFunction
this->bigNG.copy(tem.bigNG); this->bigNG.copy(tem.bigNG);
this->edgeChannel.copy(tem.edgeChannel); this->edgeChannel.copy(tem.edgeChannel);
this->ad_check.copy(tem.ad_check); this->ad_check.copy(tem.ad_check);
this->ms_check.copy(tem.ms_check);
this->cellbw_check.copy(tem.cellbw_check);
this->bDrawAndSave = tem.bDrawAndSave; this->bDrawAndSave = tem.bDrawAndSave;
} }
void print(std::string str) void print(std::string str)
@ -2417,6 +2527,8 @@ struct BaseCheckFunction
bigNG.print("bigNG"); bigNG.print("bigNG");
edgeChannel.print("edgeChannel"); edgeChannel.print("edgeChannel");
ad_check.print("ad_check"); ad_check.print("ad_check");
ms_check.print("ms_check");
cellbw_check.print("cellbw_check");
printf("bDrawAndSave %d\n", bDrawAndSave); printf("bDrawAndSave %d\n", bDrawAndSave);
} }
std::string GetInfo(std::string str) std::string GetInfo(std::string str)
@ -2428,6 +2540,8 @@ struct BaseCheckFunction
str123 += bigNG.GetInfo("bigNG"); str123 += bigNG.GetInfo("bigNG");
str123 += edgeChannel.GetInfo("edgeChannel"); str123 += edgeChannel.GetInfo("edgeChannel");
str123 += ad_check.GetInfo("ad_check"); str123 += ad_check.GetInfo("ad_check");
str123 += ms_check.GetInfo("ms_check");
str123 += cellbw_check.GetInfo("cellbw_check");
// str123 += "\n"; // str123 += "\n";
return str123; return str123;
} }

@ -1542,6 +1542,91 @@ int BaseFuntonConfigJson::GetFunction(Json::Value value)
{ {
_config.bDrawAndSave = value["isOpen"].asBool(); _config.bDrawAndSave = value["isOpen"].asBool();
} }
// 盲失分析(code绑定的qx_Other)
if ("MS_Analysis" == strCode)
{
auto value_f = value;
// std::cout << value_f << std::endl;
_config.ms_check.bOpen = value_f["isOpen"].asBool();
if (_config.ms_check.bOpen)
{
// IOU分析
if (value_f["form"]["MS_Check_Param"]["ms_iou"])
{
_config.ms_check.MS_IOU = value_f["form"]["MS_Check_Param"]["ms_iou"].asFloat();
}
if (value_f["form"]["MS_Check_Param"]["ms_expand"])
{
_config.ms_check.MS_Expand = value_f["form"]["MS_Check_Param"]["ms_expand"].asFloat();
}
// 通道绑定
auto value_qx = value_f["form"]["MS_Check_Param"]["ms_main_channels"];
if (value_qx.isArray())
{
for (int idx = 0; idx < value_qx.size(); idx++)
{
std::string channel = value_qx[idx].asString();
_config.ms_check.ms_main_channel.push_back(channel);
}
}
value_qx = value_f["form"]["MS_Check_Param"]["ms_filter_channels"];
if (value_qx.isArray())
{
for (int idx = 0; idx < value_qx.size(); idx++)
{
std::string channel = value_qx[idx].asString();
_config.ms_check.ms_filter_channels.push_back(channel);
}
}
}
else
{
_config.ms_check.Init();
}
}
// Cell黑白点分析(code绑定的qx_Other)
if ("Cellbw_Analysis" == strCode)
{
auto value_f = value;
// std::cout << value_f << std::endl;
_config.cellbw_check.bOpen = value_f["isOpen"].asBool();
if (_config.cellbw_check.bOpen)
{
// IOU分析
if (value_f["form"]["CellBW_Check_Param"]["cellbw_iou"])
{
_config.cellbw_check.CellBW_IOU = value_f["form"]["CellBW_Check_Param"]["cellbw_iou"].asFloat();
}
if (value_f["form"]["CellBW_Check_Param"]["cellbw_expand"])
{
_config.cellbw_check.CellBW_Expand = value_f["form"]["CellBW_Check_Param"]["cellbw_expand"].asFloat();
}
// 通道绑定
auto value_qx = value_f["form"]["CellBW_Check_Param"]["cellbw_main_channels"];
if (value_qx.isArray())
{
for (int idx = 0; idx < value_qx.size(); idx++)
{
std::string channel = value_qx[idx].asString();
_config.cellbw_check.cellbw_main_channel.push_back(channel);
}
}
value_qx = value_f["form"]["CellBW_Check_Param"]["cellbw_filter_channels"];
if (value_qx.isArray())
{
for (int idx = 0; idx < value_qx.size(); idx++)
{
std::string channel = value_qx[idx].asString();
_config.cellbw_check.cellbw_filter_channels.push_back(channel);
}
}
}
else
{
_config.cellbw_check.Init();
}
}
return 0; return 0;
} }

Loading…
Cancel
Save