Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Estimation of vehicle speed #413

Open
a2moosh opened this issue Jun 26, 2021 · 3 comments
Open

Estimation of vehicle speed #413

a2moosh opened this issue Jun 26, 2021 · 3 comments

Comments

@a2moosh
Copy link

a2moosh commented Jun 26, 2021

If for example two lines are defined with a distance of x meters from one to the other it would be great if there could be a speed estimation added to objects.

@vsaw
Copy link
Collaborator

vsaw commented Jun 27, 2021

You are right that should give you an approximate speed. However it is currently not part of OpenDataCam and would either have to be implemented (feel free to give it a go 🙂) or you will have to do the post-processing outside of OpenDataCam.

See also #254

@vsaw vsaw changed the title Speed estimation for distance between two lines Estimation of vehicle speed Jun 27, 2021
@vsaw
Copy link
Collaborator

vsaw commented Jun 27, 2021

@tdurand Ive renamed to issue and will leave it open for people to see and measure interest. (I get the feeling it pops up every couple of months)

@haviduck
Copy link

haviduck commented Sep 19, 2021

well, i think this is doable with the current api. last time i played with odc i remember seeing drawable areas for counting. that plus counterhistory where you get entry and exit timestamps is enough along with a certainty of fps and knowing the realworld box distance.

from there on out its just math. but accurate estimations are really sketchy.. youd have to place your roi in a head on view. imagine doing this in a roundabout. youd have to calculate curvature etc.. that being said, api is enough unless i read the docs completely wrong here.

kinda like this (which is also a reasonable alternative to areas)
https://github.com/ronitsinha/speed-detector/blob/master/demo.gif

object enters view - > timestamp
object reaches line - > timestamp
pixels per meter = get to measuring

def estimateSpeed(location1, location2,ppm=8.8,fps=24):
	d_pixels = math.sqrt(math.pow(location2[0] - location1[0], 2) + 
			     math.pow(location2[1] - location1[1], 2))
	d_meters = d_pixels / ppm
	fps = 18
	speed = d_meters * fps * 3.6
	return speed


in javascript something like
function estimateSpeed(location1, location2,ppm=8.8,fps=24){ var d_pixels = Math.sqrt(Math.pow(location2[0] - location1[0], 2) + Math.pow(location2[1] - location1[1], 2)) var d_meters = d_pixels / ppm fps = 18 speed = d_meters * fps * 3.6 return speed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants