vehicle speed detection using image processing
Mostra commenti meno recenti
hi, i am doing a project to find vehicle speed using image processing. the procedure to find the speed is using kinematics equation,our video contains two imaginary lines one is starting line and other is ending line.when vehicle crosses first line counts the time upto vehicle reaches end line.distance between lines known to us and time calculated from algorithm.....how to find when vehicle crosses first line and leaves the second line ....... waiting for reply thanks you in advance
6 Commenti
sai kiran
il 30 Set 2016
can you send me the code
AVISHEK KUMAR
il 6 Mag 2017
Modificato: Walter Roberson
il 5 Dic 2017
clc;
close all;
inputvideo=vision.VideoFileReader('traffic.avi');
vid1=vision.VideoPlayer;
while~isDone(inputvideo)
frame1=step(inputvideo);
step(vid1,frame1);
pause(0.005);
end
imwrite(frame1,'D:\referenceimage.jpg','jpg');
release(inputvideo);
release(vid1);
referenceimage=imread('D:\referenceimage.jpg');
vid2=vision.VideoFileReader('Traffic.avi');
X=zeros(2,121);
Y=zeros(2,121);
Z=zeros;
for i=2:121
clc
frame=step(vid2);
frame2=((im2double(frame))-(im2double(referenceimage)));
frame1=im2bw(frame2,0.2);
[labelimage]=bwlabel(frame1);
stats=regionprops(labelimage,'basic');
BB=stats.BoundingBox;
X(i)=BB(1);
Y(i)=BB(2);
Dist=((X(i)-X(i-1))^2+(Y(i)-Y(i-1))^2)^(1/2);
Z(i)=Dist;
if(Dist>10&&Dist<20)
display('MEDIUM SPEED');
elseif(Dist<10)
display('SLOW SPEED');
else
display('FAST SPEED');
end
S=strel('disk',6);
frame3=imclose(frame1,S);
step(vid1,frame1);
pause(0.05);
end
M=median(Z);
Speed=(M)*(120/8);
release(vid1)
saravana arumugam
il 16 Dic 2017
Please can you give me the details about the algorithm for speed measurement. Because I'm doing this project.
Walter Roberson
il 16 Dic 2017
saravana arumugam: the algorithms for vehicle speed measurement depend upon your situation. Are you using a fixed camera position and fixed focus and a scene in which the real-world distance between two points on the image is known? Or are you using a pair of cameras giving a stereo view onto an scene in which distances are not known? Or do you have a situation with one or more moving cameras?
SHOBA MOHAN
il 31 Dic 2017
Though I got the output, the following error also comes after the execution of the above code mentioned by @Avisekkumar . Can anyone help me how to resolve it?
Too many outputs requested. Most likely cause is missing [] around left hand side that has a comma separated list
expansion.
Error in speed_1 (line 25)
BB=stats.BoundingBox;
Walter Roberson
il 31 Dic 2017
That code is wrong. It assumes that only one region will be found on the video. You can get rid of the error message by using
BB = stats(1).BoundingBox;
but this will just pick out the first thing it finds in the image, without concern about whether it makes sense.
Risposta accettata
Più risposte (4)
Thilakam kuttiannan
il 5 Dic 2017
Modificato: Walter Roberson
il 5 Dic 2017
0 voti
sir
I have a doubt.I am currently doing a project on vehicle speed detection. when I am using your code I am getting an error ??? Undefined function or variable 'vision'. what is the problem with this code. What is an alternative of this error.
sir currently i am using Matlab 2010 b version
waiting for reply thanks you in advance
1 Commento
Walter Roberson
il 5 Dic 2017
The Computer Vision Toolbox did not exist in R2010b. In R2010b, all that existed was https://www.mathworks.com/help/releases/R2010b/toolbox/vipblks/ Video and Image Processing Blockset which was for Simulink.
You would need at least R2012a to use the Computer Vision Toolbox.
Thilakam kuttiannan
il 28 Ago 2018
Modificato: Image Analyst
il 28 Ago 2018
Sir
I have a doubt.I am currently doing a project on vehicle speed detection. when I am using your code I am getting an error ??? Insufficient number of outputs from right hand side of equal sign to satisfy assignment.
Error in main (line 28)
BB= stats.BoundingBox;
What is the problem with this code? What is an alternative of this error?
Sir currently I am using Matlab 2015 b version.
Waiting for reply thanks you in advance
Herewith i have attached the coding also
5 Commenti
Image Analyst
il 28 Ago 2018
Add this after the call to regionprops():
if isempty(stats)
continue;
end
Ameni chetouane
il 11 Giu 2019
Sir I used your code for vehicle speed detection but I m getting the value of M and S=0
What is the problem with this code?
Waiting for reply thanks you in advance.
Walter Roberson
il 14 Giu 2019
We do not have your pontbiz2.mp4
I tried using traffic.avi as Image Analyst suggested, but I discovered that it has been unreadable in every release since at least R2014a.
Ameni chetouane
il 18 Giu 2019
thank your for your reply.
Ameni chetouane
il 18 Giu 2019
can i send you the video test to your mail address because i couldn't attach the video.
Thilakam kuttiannan
il 29 Ago 2018
0 voti
thank you very much sir
NGUYEN THE VY
il 14 Mag 2022
0 voti
i dont know how to do the theoretical basis part for this project. I hope anyone help me list me
theory section.
thank you very much!
1 Commento
Walter Roberson
il 14 Mag 2022
See my comment above. You might need to click to expand comments.
https://www.mathworks.com/matlabcentral/answers/22194-vehicle-speed-detection-using-image-processing#comment_516852
Categorie
Scopri di più su Detection and Tracking in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!