Giter VIP home page Giter VIP logo

car_detection_counting's Introduction

car_detection_counting

An algorithm for car detection and counting, which is based on frame difference. Demo video can be found here here

Requirement

  • C++
  • OpenCV3.0

Usage

The path of video can be set in "test.cpp".

capture.open("E:\traffic\苏交科视频\无人机\无人机2\视频\9.MP4");

Also, the number and position of counting lines can be set in "test.cpp".

//line1
pair<double, double> downOutStart(0.43, 0.75);
pair<double, double> downOutEnd(0.455, 0.75);
crossingLineStart.push_back(downOutStart);
crossingLineEnd.push_back(downOutEnd);
crossingLineColor.push_back(Scalar(rand() % 255, rand() % 255, rand() & 255));

Debug, show intermediate result, save result.

#define SHOW_FLAG true
#define DEBUG_BY_STEP false
#define SAVE_VIDEO false

Adjust parameters to handle videos with different view, resolution. The parameters can be set in "Blob.h".

const int minBlobArea = 100;
const int maxBlobArea = 10000;
const int minBlobWidth = 10;
const int maxBlobWidth = 150;
const int minBlobheight = 10;
const int maxBlobheight = 150;
const int minBlobDiagonal = 10;
const int maxBlobDiagonal = 150;
const int maxBlobNum = 500;                      //skip noisy frame
const double minBlobRatio = 0.2;
const double maxBlobRatio = 4;
const double leftBoundingCoefficient = 0;
const double rightBoundingCoefficient = 1;
const double upBoundingCoefficient = 0;
const double bottomBoundingCoefficient = 1;
const double IOUThreshold = 0.7;
const double resizeHeightCoefficient = 1;
const double resizeWidthCoefficient = 1;

car_detection_counting's People

Contributors

hjptriplebee avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.