andrewssobral / simple_vehicle_counting Goto Github PK
View Code? Open in Web Editor NEWVehicle Detection, Tracking and Counting
Vehicle Detection, Tracking and Counting
Hi,
I could build your sample project in vs2013. Then I tried to apply DPEigenbackgroundBGS instead of PixelBasedAdaptiveSegmenter. I copied .h and .cpp from BGSLibrary to package_bgs and changed some codes as follows, then the building progress was interrupted.
How to apply DPEigenbackgroundBGS in this program?
Thanks!
Here are my changes in Demo.cpp
cv::Mat img_eigbkg;
DPEigenbackgroundBGS* bgs;
bgs->process(img_input, img_mask, img_eigbkg);
hello , first thanks for your good library .
i try to count cars and also i want to put number of each car above the car.
i try to do it but i saw one of car not die and another car keep on its track , so total number always is wrong and number of each car also wrong. i really confused and wast more time on this bug.
please tell me whats the problem? and how i can do that?
another problem happen, when i ShowAB=0 i saw that both A->B and B->A counting that must just one of them counted in vertical or horizontal line, i think its related to before problem that i pointed to.
thanks in advance
i waiting for your help
I copied the code as is but I get an error at the code that reads
cv::Mat img_input(frame);
the error i get says
Severity Code Description Project File Line Suppression State
Error (active) no instance of constructor "cv::Mat::Mat" matches the argument list
Hello,
I need to train it to detect multiple front faced cars. Which xml i have replace?
I need to train Haar XML right?
Is it detecting multiple cars now, or I should set it to?
Hi Andrew,
Could you please create a Github repo for the Dockerfile you published on https://hub.docker.com/r/andrewssobral/vehicle_detection_tracking_counting/?
Thanks
Hello, Mr. Andrew. I'm Teddy Ernanto. Before I ask about how to detect motorcycle and it works in VS2013 Windows. Now, I use odroid with OS Linux Ubuntu 14.04 and OpenCV 2.4.12. The system works is too slow when detect from camera.
sorry about this but I do not know whether or not my Computer is absolute but you sample really lags, I do not think its my computer, I was doing a background subtractor app in Java with frame size of 700 + 600 and was working perfect with no lag but this sample lags uncontrollably, is there something am missing out that I have not yet discovered?
its can be detect the speed of cars ?
Hello,
I succesfully compiled the proj. But when I have started app cvCaptureFromAVI in line #15 returns NULL. Do you have any ideas in what the matter? Maybe I must to install something additional like ffmpeg?
Thanks,
Igor
Hello i was unable to build the projcect when doing make
.
The error was the following:
[ 61%] Building CXX object CMakeFiles/simple_vehicle_counting.dir/package_tracking/cvblob/cvlabel.cpp.o
In file included from /home/pi/CV/simple_vehicle_counting/package_tracking/cvblob/cvlabel.cpp:30:0:
/home/pi/CV/simple_vehicle_counting/package_tracking/cvblob/cvblob.h:433:4: warning: extra ‘;’ [-Wpedantic]
};
^
/home/pi/CV/simple_vehicle_counting/package_tracking/cvblob/cvlabel.cpp:38:3: error: narrowing conversion of ‘-1’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
};
^
/home/pi/CV/simple_vehicle_counting/package_tracking/cvblob/cvlabel.cpp:38:3: error: narrowing conversion of ‘-1’ from ‘int’ to ‘char’ inside { } [-Wnarrowing
./package_bgs/PBAS/PBAS.h:120:32: error: a space is required between consecutive right angle brackets (use '> >')
std::vector<std::vector<float*>>B_Mag_Pts;
P.S. I am using Raspberry Pi and Pi cam for this setup.
Am i Missing something?
[ 7%] Building CXX object CMakeFiles/simple_vehicle_counting.dir/package_bgs/PBAS/PixelBasedAdaptiveSegmenter.cpp.o
In file included from /home/nakul/work/yolo/simple_vehicle_counting/package_bgs/PBAS/PixelBasedAdaptiveSegmenter.h:7,
from /home/nakul/work/yolo/simple_vehicle_counting/package_bgs/PBAS/PixelBasedAdaptiveSegmenter.cpp:1:
/home/nakul/work/yolo/simple_vehicle_counting/package_bgs/PBAS/../IBGS.h:3:10: fatal error: cv.h: No such file or directory
3 | #include <cv.h>
| ^~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/simple_vehicle_counting.dir/build.make:76: CMakeFiles/simple_vehicle_counting.dir/package_bgs/PBAS/PixelBasedAdaptiveSegmenter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/simple_vehicle_counting.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
i use opencv 3.3.0 and 64bit windows. after run your sample c++ in QT , error happened:
PBAS()
PixelBasedAdaptiveSegmenter()
BlobTracking()
VehicleCouting()
Press 'q' to quit...
OpenCV Error: Null pointer (Invalid pointer to file storage) in cvWriteInt, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\persistence.cpp, line 4625
I am having difficulties trying to get the Python Demo working. I had to change "from _-------- import ---------" lines in "build" to simply "from --------- import ---------" inorder to fix import errors. Unfortunately, I have gotten stuck at:
"from bgs.pbas import *" in the init.py file in the /bgs/pbas folder. When I try to run the demo file, I get
Traceback (most recent call last):
File "./demo.py", line 17, in <module>
segmenter = pbas.PixelBasedAdaptiveSegmenter()
AttributeError: 'module' object has no attribute 'PixelBasedAdaptiveSegmenter'
I am not sure how to debug this issue.
Hello Andrew,
Is this version compatible with OpenCV 320
Visual studio 2015?
Regards
Wheter your code is based on the paper named "Vehicle Detection, Tracking and Counting"?thank you!
Which part of this code consume so much resource? How can I optimize the code to let the test video play smoothly?
Hi, I am trying to compile this project using OpenCV 3.4.2 and MS Visual Studio 2017 x64.
As the product versions differ from the versions you tested on, I am giving you the commands that I used.
After cloning the repo and cd'ing into "simple_vehicle_counting" folder, I used -
I can see all the .vcxproj file and so but not any BGS.SLN file to open it in the VS 2017. I tried it many way but no luck.
Screenshots:
I am trying to run this project for almost two days now. Please help, sir.
as title said, can the program calculate the speed of vehicle with some parameters in highway?
hello sir..thanks for your source code .It is working properly ,but
how will we detect multiple vehicle at same time when it's pass a horizontal line??
...plz modified the source code..
Hello,
I follow the instructions on the main site trying to use the Python demo. These are the commads I have entered so far:
~/git clone --recursive https://github.com/andrewssobral/simple_vehicle_counting.git
~/cd simple_vehicle_counting
~/simple_vehicle_counting/cd build
~/simple_vehicle_counting/build/ cmake ..
~/simple_vehicle_counting/build/make -j 8
However, when running the 'make' command (and when trying to build the normal C version, the same error shows up), it fails with Error 2. Here is the end of the output:
...
/home/tamas/simple_vehicle_counting/package_tracking/cvblob/cvcontour.cpp:378:3: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/home/tamas/simple_vehicle_counting/package_tracking/cvblob/cvlabel.cpp: In function ‘cvb::CvLabel cvb::cvGetLabel(const IplImage*, unsigned int, unsigned int)’:
/home/tamas/simple_vehicle_counting/package_tracking/cvblob/cvlabel.cpp:442:3: warning: control reaches end of non-void function [-Wreturn-type]
}
^
CMakeFiles/simple_vehicle_counting.dir/build.make:230: recipe for target 'CMakeFiles/simple_vehicle_counting.dir/package_tracking/cvblob/cvlabel.cpp.o' failed
make[2]: *** [CMakeFiles/simple_vehicle_counting.dir/package_tracking/cvblob/cvlabel.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/simple_vehicle_counting.dir/all' failed
make[1]: *** [CMakeFiles/simple_vehicle_counting.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
What is the problem and how can I fix it? Or how can I modify the Python code so that I don't have to actually build the project?
Thanks for the answers in advance!
Hi. This might be a newbie question/problem, but I'm not finding any help online so far.
So, I'm just trying to make the project at
~/simple_vehicle_counting/build $ sudo make
And then I'm receiving
/usr/bin/ld: warning: libicui18n.so.56, needed by ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicuuc.so.56, needed by ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicudata.so.56, needed by ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para u_strToLower_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucnv_getStandardName_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucnv_getAlias_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
uenum_next_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para u_strToUpper_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucnv_setSubstChars_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucal_getTimeZoneDisplayName_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucnv_fromUnicode_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para u_errorName_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
uenum_close_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucal_getDSTSavings_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucal_openTimeZoneIDEnumeration_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucal_setMillis_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucol_close_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucol_getSortKey_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucal_get_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucol_open_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucnv_compareNames_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucal_clone_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucal_open_56'
~Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucol_setAttribute_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucal_openCountryTimeZones_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucnv_open_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucal_openTimeZones_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucnv_countAliases_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucal_inDaylightTime_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucal_close_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucnv_getAvailableName_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucnv_getDefaultName_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucal_getDefaultTimeZone_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucnv_toUnicode_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucol_strcoll_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para ucnv_close_56' ~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para
ucnv_getMaxCharSize_56'
~/Qt/5.8/gcc_64/lib/libQt5Core.so.5: referência indefinida para `ucnv_countAvailable_56'
collect2: error: ld returned 1 exit status
CMakeFiles/simple_vehicle_counting_bin.dir/build.make:138: recipe for target 'simple_vehicle_counting' failed
make[2]: *** [simple_vehicle_counting] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/simple_vehicle_counting_bin.dir/all' failed
make[1]: *** [CMakeFiles/simple_vehicle_counting_bin.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Any tips? Thanks in advance.
Hi Andrews, I notice that you said the project can use OpenCV 2.4.x (it only works with this version).I run your code, it runs successful, but it couldn't load the video.avi, I try some methods to solve this problem but they all failed. I‘d like to ask if its gonna possible because I use the version of opencv is 2.4.9 rather than 2.4.10. Thank you so much~
Hello, Mr. Andrew. I'm Teddy Ernanto. I ask where is the code must changed for detect motorcycle? Change minArea & maxArea or any else?
Using Ubuntu 16.04
Build
Testing
../run_simple_vehicle_counting.sh runs OK
../run_python_demo.sh
Traceback (most recent call last):
File "./build/python/demo.py", line 4, in
import analysis
File "/home/zeev/PYTHON/SIMPLE-VEHICLE-COUNT/simple_vehicle_counting/build/python/analysis/init.py", line 6, in
import pyboostcvconverter as pbcvt
ImportError: No module named pyboostcvconverter
Apparently __init__.py was missing in pyboostconverter folder, so entered
touch python/pyboostcvconverter/__init__.py
../run_python_demo.sh
PBAS()
PixelBasedAdaptiveSegmenter()
VehicleCouting()
BlobTracking()
../run_python_demo.sh: line 4: 2089 Segmentation fault (core dumped) python ./build/python/demo.py
Any suggestions to help locate the problem?
Hello Andrewssobral, i don't understand your step to install python API "/simple_vehicle_counting/build/cp -r ../python/* python/" . But i installed the program normally.
When i run the "demo.py" i have always import errors. The script is on the same root paste of the packet analysis.
Do you have any idea to solve my problem, or what i am doing wrong?
ERROR:
Traceback (most recent call last):
File "demo.py", line 4, in
import analysis
File "/home/miguel/simple_vehicle_counting/python/analysis/init.py", line 1, in
from _analysis import *
ImportError: No module named _analysis
Hi, thank you for response my question on https://www.youtube.com/watch?v=27JxVkpIXW0 ..
I can't opened the video from your project file. When I debug your program, the 'black box' will showed and just closed but I've read the message from the black box. the message is, 'cannot open the video'.. Black box I mean, a box with black color. please give me a solution, thank you so much, Sir.
Traceback (most recent call last):
File "demo.py", line 4, in
import analysis
File "/home/comp-proj-22/simple_vehicle_counting/python/analysis/init.py", line 1, in
from _analysis import *
ModuleNotFoundError: No module named '_analysis'
This is absolute shit.
The performance on this motherfucker is just astronomic.
On a 480p uncompressed m-jpeg video it ran about 10fps on a i7-6700k CPU.
Tried different vms, tried different physical machines, tried different input videos. Same thing.
Sorry but your code is shit.
P.S. This shit was forked 91 times...
it alwayls give me error, cant open video, can you help me?
***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****
Using OpenCV 3.2.0
PBAS()
PixelBasedAdaptiveSegmenter()
BlobTracking()
VehicleCouting()
Press 'q' to quit...
OpenCV Error: Assertion failed (dims <= 2 && step[0] > 0) in cv::Mat::locateROI, file D:\opencv\sources\modules\core\src\matrix.cpp, line 949
issues:There is no appropriate user-defined conversion from "cv::Scalar" to "const CvScalar"
environment:VS2017
CMAKE:3+
Do you have any idea how to make a Python Code instead of using C. I am not a big fan of Microsoft Languages 😄 . Help would be really appreciated, detection is easy to do, but my problem is in counting
or how to I convert these to python?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.