代码拉取完成,页面将自动刷新
/*********************************
* 压线违章类
* @ZZH
* date:2019/9/23
* *******************************/
#include "line_pressured.h"
line_pressured::line_pressured()
{
}
//压线ROI区域储存函数
std::vector<cv::Rect> line_pressured::line_pressured_ROI(cv::Rect roi_1st)
{
std::vector<cv::Rect>ROI_AREA;
ROI_AREA.push_back(roi_1st);
return ROI_AREA;
}
//判断压线函数
std::vector<float> line_pressured::rules(std::vector<cv::Rect> roi, std::vector<std::vector<float> > car, const cv::Mat &img)
{
illegal_process pre;
extern cv::Mat line_pressured_license;
extern cv::Mat no;
//压线判断1个ROI即可
for (int i=0;i<(int)car.size();i+=1){
for (int j=0;j<(int)car[i].size();j+=2){
if (pre.roi_judge(car[i][j],car[i][j+1],roi[0])){
target.push_back(i);
target.push_back(j);
target.push_back(0);
if (second_time){
img.copyTo(break1);
cv::rectangle(break1, cv::Rect(car[i][j]-200,car[i][j+1]-200,400,400),cv::Scalar(0,0,255),3,8,0);
car_br = pre.slice(break1,cv::Rect(car[i][j]-100,car[i][j+1]-100,200,200));
cv::resize(break1,break1,cv::Size(1080,720));
//违章证据保存
x = snprintf(pic_name,sizeof(pic_name),"press_line_car%d_evid.jpg",num);
cv::imwrite(pic_name,break1);
//违章车辆保存
z = snprintf(pic_name,sizeof(pic_name),"press_line_car%d.jpg",num);
cv::imwrite(pic_name,car_br);
car_br_e=cv::imread(pic_name);
car_license= car_lic.detection(car_br_e);
//违章车牌保存
e = snprintf(pic_name,sizeof(pic_name),"press_line_car%d_license.jpg",num);
cv::imwrite(pic_name,car_license);
line_pressured_license = cv::imread(pic_name);
if(line_pressured_license.empty())
{
line_pressured_license = no;
}
cv::resize(line_pressured_license,line_pressured_license,cv::Size(52,16));
cv::cvtColor(line_pressured_license,line_pressured_license,COLOR_BGR2RGB);
second_time = false;
num+=1;
}
return target;
}
}
}
//次数核查
//std::cout<<"_line_pressured_"<<std::endl;
return target;
}
//资源释放函数
void line_pressured::line_pressured_release()
{
target.clear();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。