Giter Club home page Giter Club logo

cardetect's Introduction

car detection

implements Vehicle detection through cascade classifier.The cascade classifier is trained by OpenCV's demon app "opencv_traincascade"

image

you can get the binary in the bin folder

I will provide execute for windows and linux,and here are some Requirements

Linux:

Requirements:
  1) GCC 5.x
     From: http://gcc.gnu.org/releases.html
     Or via apt:
     sudo apt-get install g++
  2) GTK+
     sudo apt-get install libgtk2.0-dev
  2) libpng12-dev
     sudo apt-get install libpng12-dev
  3) OpenCV 2.4.10 library
     From: http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.10/opencv-2.4.10.zip/download
     you need to compile the source code and install opencv library

Windows:

Requirements:
  1) DirectX 11
    From: https://www.microsoft.com/en-us/download/details.aspx?id=8109
  2) MSVC 14.0
    From: https://www.microsoft.com/en-us/download/details.aspx?id=48145
  3) MSVC 12.0
  	From: https://www.microsoft.com/en-us/download/details.aspx?id=40784

###Build Step

Linux

for 64 - bit system, assume you hava already install opencv in /usr/local/opencv-2.4.10/

cd current directory
make

Windows

you need to install Micsoft Visual Studio i provide a Visual Studio 2015 solution in project folder (include OpenCV library),you can download and build it.

###Run Step

Linux

cd bin/
./objectdetect

By default,read the images from the current directory data and load the classifier from cascade. xml. You can use thsi options:

-v: read video files.

-d: read the file from the directory, note that the directory can only contain image files, default:./data/.

-c: loaded cascade classifier file name, default: cascade. xml.

-cam: open camera.

./objectdetect  [-v videofilename] [-c cascadename] [-d datadirctory] [-cam [id]]

examples: read frame from video

cd bin/
./objectdetect -v video1.avi

read frame from file

cd bin/
./objectdetect -d data/

load specific cascade

cd bin/
./objectdetect -d data/ -c cascade1.xml

read frame from camera ,default open 0

cd bin/
./objectdetect -cam  1 -c cascade1.xml

Windows

you can download x64.zip file ,if you use x64 system,download x86.zip file if you use x86 system.unzip the file, and you can run cardetect.exe directly if you hava DirectX 11 run enviroment.

###**Key Instructions **

key 's' : Stop/Continue auto play,only aviliable in read from file or video

key 'a' : Back 1 frame/picture,only aviliable in read from file or video

key 'd' : Forward 1 frame/picture,only aviliable in read from file or video

key 'k' : Back 60 frames / 5 pictures,only aviliable in read from file or video

key 'l ' : Forward 60 frames / 5 pictures,only aviliable in read from file or video

key 'ESC' : exit

cardetect's People

Contributors

tangchent avatar githubtangchen avatar

Stargazers

vcbchang avatar  avatar

cardetect's Issues

windows platform crash

when i tried to port this code into windows platfrom,i meet this problem.
In the official face detect code provide by opencv,they use this code to detect faces and return result use a reference faces

void detectAndDisplay(Mat frame)
{
	std::vector<Rect> faces;
    Mat frame_gray;

in my code ,when i call car_cascade.detectMultiScale ,it can work on linux, but when run in window ,it will crash .but if i use the face detect XML,this can work again.

this can solve by set the local variable faces into gobal variable

  /** Global variables */
#ifdef _WIN32
std::vector<Rect> cars;
#endif
String car_cascade_name = "cascade.xml"; //the cascades file name
CascadeClassifier car_cascade;
String window_name = "Car detection";

but when the program return , it will crash.

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.