汽车的检测和计数 opencv3.0.0 c++.
Detection and counting of cars opencv3.0.0 c++
我有一个记录道路上汽车交通的视频,我想用opencv 3.0.0和c ++对这些汽车进行检测和计数,这里有以下源代码
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<iostream>
#include<conio.h> // it may be necessary to change or remove this line if not using Windows
int main(int argc, char** argv)
{
cv::VideoCapture capVideo;
capVideo.open("CarsDrivingUnderBridge.mp4");
if (!capVideo.isOpened())
return -1;
Mat frame;
/// Create Window
namedWindow("Result", 1);
while (true) {
//grab and retrieve each frames of the video sequentially
cap >> frame;
//draw a line onto the frame
line(frame, Point(0, frame.rows / 2), Point(frame.cols, frame.rows / 2), Scalar(0), 3);
//display the result
imshow("Result", frame);
line(frame, Point(0, frame.rows / 8), Point(frame.cols, frame.rows / 8), Scalar(0), 3);
imshow("Result", frame);
//wait some time for the frame to render
waitKey(30);
}
return 0;
}
此代码可以读取视频并在此视频上绘制两行。 我可以为此源代码添加什么 用于检测汽车并计算这些汽车的线
要检测汽车,您可以使用斑点检测器。定义最小和最大大小,并在 Blob 通过特定(需要定义该(行时增加计数器。
您还可以在互联网上搜索"人流量统计器",您会发现其他读数
这是我解决这个问题的方法,但在 python 中 https://medium.com/@a.nikishaev/tutorial-making-road-traffic-counting-app-based-on-computer-vision-and-opencv-166937911660
相关文章:
- 未在此作用域OpenCV3.4中声明cvSaveImage
- OpenCV3.3 CUDA 堆栈粉碎
- 在Win10上使用带有Qt5的OpenCV3.0,调试断言失败
- 在Visual Studio 2017上无法使用调试模式x64进行OpenCV3.2编译
- 无法通过OpenCv3.2加载Squeezenet 1.0或1.1
- 如何在Mac上使用带有C++的brew opencv3
- OpenCv3.3安装错误-未定义对的引用
- 汽车的检测和计数 opencv3.0.0 c++.
- 贝叶斯和SVM分类器在OpenCV3中的实现
- 如何在opencv3中使用UMat来训练人脸识别
- 在MaxOSX10.12.4上成功安装OpenCV3,但它不起作用
- 不能在 OS X 上包含 opencv3
- OpenCV3.2 编译错误 MAC OS X
- 如何使用向量设置 OpenCV3 calcHist() 的参数
- OPENCV3带有阈值函数的错误
- 当酿造安装OpenCV3时,我会警告说公式没有 - 与contrib选项
- 如何使用opencv_contrib编译 Opencv3.2.0
- 在 Qt 中使用 for 与 OpenCV3 时出错
- 如何在 ROS Indigo 下正确链接 opencv3(使用 CMake)
- 使用 mingw 编译 opencv3.1