Coder Social home page Coder Social logo

andrewssobral / vehicle_detection_haarcascades Goto Github PK

View Code? Open in Web Editor NEW
532.0 50.0 527.0 5.6 MB

Vehicle Detection by Haar Cascades with OpenCV

Batchfile 10.43% C++ 60.28% Python 16.32% CMake 8.88% Shell 4.08%
vehicle-detection haar-cascade cascade-classifier opencv car

vehicle_detection_haarcascades's Introduction

Vehicle Detection with Haar Cascades

Last page update: 19/10/2016

Last version: 1.0.0 (see Release Notes for more info)

Hello everyone, An easy way to perform vehicle detection is by using Haar Cascades. Currently, I don't have a detailed tutorial about it, but you can get some extra information in the OpenCV homepage, see Cascade Classifier page. See also Cascade Classifier Training for training your own cascade classifier.

The haar-cascade cars.xml was trained using 526 images of cars from the rear (360 x 240 pixels, no scale). The images were extracted from the Car dataset proposed by Brad Philip and Paul Updike taken of the freeways of southern California.

For more information, please see:

For Windows users

  • Check if your OpenCV is installed at: C:\OpenCV2.4.10
  • There is a Visual Studio 2013 template project in the vs2013/ folder. Open it in the Visual Studio IDE and select [Release]-[Win32] or [Release]-[x64] mode. Next, click on run_vehicle_detection.bat and enjoy!

For Linux users

  • For Linux and Mac users, a Makefile is provided to compile the source code.
    • Requirements: OpenCV 2.4.x (it only works with this version).
    • Check out the latest project source code and compile it:
~/git clone https://github.com/andrewssobral/vehicle_detection_haarcascades.git
~/cd vehicle_detection_haarcascades
~/vehicle_detection_haarcascades/ chmod +x run_vehicle_detection_video1.sh
~/vehicle_detection_haarcascades/ chmod +x run_vehicle_detection_video2.sh
~/vehicle_detection_haarcascades/cd build
~/vehicle_detection_haarcascades/build/ cmake ..
~/vehicle_detection_haarcascades/build/ make
    • Run demos:
~/vehicle_detection_haarcascades/run_vehicle_detection_video1.sh
~/vehicle_detection_haarcascades/run_vehicle_detection_video2.sh

Docker image

Release Notes:

  • Version 1.0.0: First version.

vehicle_detection_haarcascades's People

Contributors

andrewssobral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vehicle_detection_haarcascades's Issues

Unable to link to OpenCV

I am trying to connect this to OpenCV to run it in Ubuntu. However, I am unable to establish this connection. The details of the error are included in the image below:

capture

It mentions CMAKE_MODULE_PATH, which I was unable to find in the project repository. Could you please help me get around this issue? I am doing this as an academic project and would appreciate your prompt help.

Thanks.

Questions and Assistance needed for your Vehicle Detection program.

Hello Andrew,
I am representing a group of high school students in a class called Engineering Design and Development. We are interested in using your program to detect cars to protect cyclists on the road. We have experimented with the Xbox Kinect and believe that we could use your program to help us detect cars with a camera mounted on the back of a bike for testing purposes. We have ran into some issues running your code. We are using Visual Studio 2015 and the correct version of OpenCV that you specified, however, when we open your project file in visual studio, it does not build. In some cases, the #include <...> is not able to find the opencv.hpp header file and in other cases the program is not able to find an .exe file and throws an error. We installed OpenCV in the C:\ drive and believe we have the correct directory in the #include<...>
This is the error we were receiving regarding the #include:
https://msdn.microsoft.com/en-us/library/et4zwx34.aspx

We would greatly appreciate some advice or guidance on what we are doing wrong and how we can use your program.

Ultimately we would like to build off of it to support a live feed from a webcam which we will analyze real time through a Arduino, using OpenCV.

Report file

Thank you for sharing the code. COuld you please let me know how i can get the report after running the code.
Regards

vehicle_detection_haarcascades execution: permission denied.

Hi,

I'm not sure why is it happening? I tried many things and searched extensively, but couldn't find any solution to the problem.
The problem is: while running the demo run_vehicle_detection_video1.sh, I'm getting permission denied in the terminal.
You had suggested ~/vehicle_detection_haarcascades/run_vehicle_detection_video1.sh , which wasn't working. I tried ./run_vehicle_detection_video1.sh, and sudo sh ./run_vehicle_detection_video1.sh, the former gives bash: ./run_vehicle_detection_video2.sh: Permission denied, while the latter has output ./run_vehicle_detection_video2.sh: 2: ./run_vehicle_detection_video2.sh: ./build/vehicle_detection_haarcascades: Permission denied

Can you suggest what to do?

Windows issue: It just crashed down

I am using a Windows10 system, and I have successfully generated the .exe file using project.sln.
I generated the .exe file in x86 and x64 mode, but neither can run.
They would crash down every time I run it on the command line or use .bat directly.
Can anybody suggest anything on this matter?
Many thanks.

Mixed results when applying to my own dataset

Hello

First I would like to say thank you for putting this code online.

However I have some questions if I want to use this method do I have to re-train the haar cascade classifier on my own dataset? Or can I use your trained cascade?

The results I'm getting, using your trained data are the following;

Positive;

image

Negative;

image

Could you explain why I'm getting mixed results?

Thx in advance!

My regards

Sklip

Create Xml files

could you help me how to create xml files from the video image data

HaarCascade c#

Hi,

Is there a way to implement HaarCascade car into Visual Studio using c#. Any help would be appreciated have been unsuccessful so far.

Thanks

XML Parse error

I am getting XML parse error, I am not sure what the compilation part is for, but I didn't do it. My project was setup for different cascade that I trained and worked fine, but this one gives me XML parse error :

When I open the file with Firefox browser:

XML Parsing Error: not well-formed
Location: file:///home/h/NetBeansProjects/cv/cars.xml
Line Number 43, Column 91:  <meta name="request-id" content="CF1C:6815:15606E1:28D6456:5B0A3FD0" data-pjax-transient>

OpenCV Error:

OpenCV Error: Unknown error code -49 (Input file is empty) in cvOpenFileStorage, file /home/h/opencv/OpenCV/opencv-3.3.0/modules/core/src/persistence.cpp, line 4484
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/h/opencv/OpenCV/opencv-3.3.0/modules/core/src/persistence.cpp:4484: error: (-49) Input file is empty in function cvOpenFileStorage

Can you give me your input please?

Thank you

Problem with docker vncserver

Hello andrewssobral,

thanks for your codes.
I'm looking on your docker side, there is a error about vncserver.

Window manager warning: Log level 16: metacity: Fatal IO error 11 (Resource temporarily unavailable) on X server :1.

Could you help me for this case?

thanks,
Yunbo

on Raspberry Zero

Has anyone seen this error?

(venv) pi@raspberrypi:~/myproject/vehicle_detection_haarcascades $ ./run_vehicle_detection_video1.sh
Using OpenCV 3.3.1
Unable to stop the stream: Inappropriate ioctl for device
vehicle_detection_haarcascades: /home/pi/myproject/vehicle_detection_haarcascades/vehicle_detection.cpp:36: int main(int, char**): Assertion `cascade && storage && capture' failed.
./run_vehicle_detection_video1.sh: line 2: 1504 Aborted ./build/vehicle_detection_haarcascades cars.xml dataset/video1.avi

CARS xml

Cars xml does't have accuracy to the point , its detects all the other things shown in the videos like men face, bikes etc etc during using webcam.

Traninged XML is different

Hello, I trained I own xml, but the structure is soooo different. I used the project you provided below the documentation. I got something like this, and when I try to use it it gives me an error.
image

identifying individual object

Hi..
I have implemented the same and getting results as you have shown. The issue here is I need to identify each individual object in each sequence of frame in video(input source). Can you tell me please how to identify/track particular object in consecutive frames from the list of rectangles from given output?

Can't get it working with OpenCV 3.1.0

Hello Andrew,

Thank you for sharing this project. It's great help. I've recently started working with OpenCV for vehicle detection. Unfortunately, I can't make this project functional with OpenCV. I've tried version 3.1.0 as well as 2.4.12. Program exists with statement

"Usage ... cascade.xml video.avi"

Please let me know how to fix this. Thank you.

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.