我是 opencv 的新手。我正在尝试检测特定图像中的车辆,例如大小为 (300, 400) 的图像的 x=0 到 139 和 y=0 到 300。
那么我应该使用什么条件在特定区域进行检测并在车辆通过后进入框架进行计数?
enter code herevoid processVideo(char* videoFilename) {
//create the capture object
`VideoCapture capture(videoFilename);
if(!capture.isOpened()){
//error in opening the video input
cerr << "Unable to open video file: " << videoFilename << endl;
exit(EXIT_FAILURE);
}
//read input data. ESC or 'q' for quitting
while( (char)keyboard != 'q' && (char)keyboard != 27 ){
//read the current frame
if(!capture.read(frame)) {
cerr << "Unable to read next frame." << endl;
cerr …Run Code Online (Sandbox Code Playgroud)