update 支架绘制添加开关

dev_lsy
liusiyang 3 weeks ago
parent 3ba4f47434
commit 950152e788

@ -2548,8 +2548,8 @@ int ImgCheckAnalysisy::DrawResult_Step_1()
} }
} }
// 支架偏移检测绘制:支架中心十字(绿=正常/红=偏移NG)+ 支架到边缘的距离(绿=正常/红=超标准) // 支架偏移检测绘制(受参数 bDrawSupport 控制,默认关闭):支架中心十字(绿=正常/红=偏移NG)+ 支架到边缘的距离(绿=正常/红=超标准)
if (m_SupportDrawInfo.bValid && !m_CheckResult_shareP->resultimg.empty()) if (m_SupportDrawInfo.bValid && m_pbaseCheckFunction->supportDet.bDrawSupport && !m_CheckResult_shareP->resultimg.empty())
{ {
// 支架中心:原图坐标 -> 检测图(裁剪) -> 结果图 // 支架中心:原图坐标 -> 检测图(裁剪) -> 结果图
cv::Point2f detPt = MatAffinePoint(m_matSrc2Det, m_SupportDrawInfo.ptCenter); cv::Point2f detPt = MatAffinePoint(m_matSrc2Det, m_SupportDrawInfo.ptCenter);

@ -923,6 +923,7 @@ struct Function_Support_Det
{ {
// 支架参数(Support_Detect) // 支架参数(Support_Detect)
bool bDetSupport; // 支架偏位检测开关(Support_Detect.isOpen) bool bDetSupport; // 支架偏位检测开关(Support_Detect.isOpen)
bool bDrawSupport; // 支架绘制开关(Support_Detect.form.support_param.bDrawSupport):是否绘制支架中心十字/距离线
float x_standard; // 水平方向标准距离(left/right 用) float x_standard; // 水平方向标准距离(left/right 用)
float y_standard; // 垂直方向标准距离(up/down 用) float y_standard; // 垂直方向标准距离(up/down 用)
std::vector<std::string> edge_select; // 参与计算的方向:up/down/left/right std::vector<std::string> edge_select; // 参与计算的方向:up/down/left/right
@ -950,6 +951,7 @@ struct Function_Support_Det
void Init() void Init()
{ {
bDetSupport = false; bDetSupport = false;
bDrawSupport = false;
x_standard = 0; x_standard = 0;
y_standard = 0; y_standard = 0;
edge_select.clear(); edge_select.clear();
@ -969,6 +971,7 @@ struct Function_Support_Det
void copy(Function_Support_Det tem) void copy(Function_Support_Det tem)
{ {
this->bDetSupport = tem.bDetSupport; this->bDetSupport = tem.bDetSupport;
this->bDrawSupport = tem.bDrawSupport;
this->x_standard = tem.x_standard; this->x_standard = tem.x_standard;
this->y_standard = tem.y_standard; this->y_standard = tem.y_standard;
this->edge_select.assign(tem.edge_select.begin(), tem.edge_select.end()); this->edge_select.assign(tem.edge_select.begin(), tem.edge_select.end());
@ -987,14 +990,14 @@ struct Function_Support_Det
} }
void print(std::string str) void print(std::string str)
{ {
printf("%s>>bDetSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld handle_diff %f BQ[area %f energy %f len %f hj %f]\n", printf("%s>>bDetSupport %d bDrawSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld handle_diff %f BQ[area %f energy %f len %f hj %f]\n",
str.c_str(), bDetSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size(), handle_diff, BQ_area, BQ_energy, BQ_len, BQ_hj); str.c_str(), bDetSupport, bDrawSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size(), handle_diff, BQ_area, BQ_energy, BQ_len, BQ_hj);
} }
std::string GetInfo(std::string str) std::string GetInfo(std::string str)
{ {
char buffer[512]; char buffer[512];
sprintf(buffer, "%s>>bDetSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld handle_diff %f BQ[area %f energy %f len %f hj %f]\n", sprintf(buffer, "%s>>bDetSupport %d bDrawSupport %d bDetHandle %d bDetTag %d x_standard %f y_standard %f x_offset %f y_offset %f r_offset %f edge num %ld handleRegion num %ld handle_diff %f BQ[area %f energy %f len %f hj %f]\n",
str.c_str(), bDetSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size(), handle_diff, BQ_area, BQ_energy, BQ_len, BQ_hj); str.c_str(), bDetSupport, bDrawSupport, bDetHandle, bDetTag, x_standard, y_standard, x_offset, y_offset, r_offset, edge_select.size(), handleRegions.size(), handle_diff, BQ_area, BQ_energy, BQ_len, BQ_hj);
std::string str123 = buffer; std::string str123 = buffer;
return str123; return str123;
} }

@ -921,6 +921,12 @@ int BaseFuntonConfigJson::GetFunction(Json::Value value)
{ {
auto value_param = value_f["form"]["support_param"]; auto value_param = value_f["form"]["support_param"];
// 支架绘制开关:控制结果图上是否绘制支架中心十字/距离线(默认关,兼容旧参数)
if (value_param["bDrawSupport"].isBool())
{
_config.supportDet.bDrawSupport = value_param["bDrawSupport"].asBool();
}
if (value_param["x_standard"]) if (value_param["x_standard"])
{ {
_config.supportDet.x_standard = value_param["x_standard"].asFloat(); _config.supportDet.x_standard = value_param["x_standard"].asFloat();

Loading…
Cancel
Save