目录 使用到了OpenCV轮廓识别 如上图 轮廓识别 分别检测识别出红灯 绿灯 [检测出来的红灯轮廓和绿灯轮廓如下图所示] 在红绿灯都亮时,可以检测到数值 当红灯不亮 绿灯亮时,红灯没有数值 绿灯显示数值 当拍摄车辆通行,也就是红绿灯都不亮的时候,红灯绿灯都没有数值 1.初始化设置,对亮度设置 视频路径 进行初始化设置 int redCount = 0; int greenCount = 0; Mat frame; Mat img; Mat imgYCrCb; Mat imgGreen; Mat imgRed; // 亮度参数 double a = 0.3; double b = (1 - a) * 125; VideoCapture capture("D:/00000000000003jieduanshipincailliao/123.mp4");//导入视频的路径 if (!capture.isOpened()) { cout << "Start device failed!\n" << endl;//启动设备失败! return -1; }...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with Mat
Contact Mat, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack