Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8536211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:36:38+00:00 2026-06-11T10:36:38+00:00

I am new to OPENCV so bear with me if there are simple things

  • 0

I am new to OPENCV so bear with me if there are simple things that I am missing here.

I am trying to work out a camera based system that can continuously output the speed of a vehicle with the following assumptions:
1. The camera is horizontally placed and the vehicle passes near 3 to 5 feet of the camera lens.
2. The speed will not be more than 30KM/Hrs

I was hoping to start with the concept of a optical mouse which detects the displacement in the surface pattern. However I am unclear as to how to handle the background when the vehicle starts to enter the frame.

There are two methods I was interested in experiment with but am looking for further inputs.

  1. Detect the vehicle as it enters the frame and separate from background.
  2. Use cvGoodFeaturesToTrack to find points on the vehicle.
  3. Track the point across the next frame. & Calculate the horizontal velocity using Lucas_Kanade Pyramid function for optical flow.
  4. Repeat

Please suggest corrections and amendments.
Also I request more experienced members to help me code this procedure efficiently since I don’t know which are the most correct functions to use here.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:36:39+00:00Added an answer on June 11, 2026 at 10:36 am

    Hope you will be using a simple camera with 20 fps to 30 fps and your camera is placed perpendicular to the road but away from it…the object i.e. your cars have a max velocity of 8 ms-1 in the image plane…calculate the speed of the cars in the image plane with the help of the lens you are using…

      ( speed in object plane / distance of camera from road ) = ( speed in image plane / focal length )
    

    you should get in pixels per second if you know how much each pixel measures…

    Steps…

    1. You can use frame differentiation…that is subtract the current frame from the previous frame and take the absolute difference…threshold the difference…this segments out your moving car from the back ground…remember this segments all moving objects…so if u want a car and not a moving man you can use the shape characteristic that is the height is to width ratio…fit a rectangle to the segmented part and in each frame do the same steps. so in each frame you can keep a record of the coordinate of the leading edge of the bounding box… that way when a car enters the view till it pass out of the view you know for how long the car has persisted…use the number of frames , the frame rate and the coordinaes of the leading edge of the bounding box to calculate the speed…

    2. You can use goodfeaturestotrack and optical flow of open cv…that way you can make distinguish between fast moving and slow moving objects…but keep refreshing the points that goodfeaturestotrack gives you or else any new car coming into the camera view will not be updated…record the displacement of the set of points picked by goodfeaturestotrack in each frame..that is the displacement of the moving object…calculate speed in the same way…the basic idea to calculate speed is to record the number of frames the object has persisted in the camera field of view…if your camera is fixed so is your field of view…hence what matters is in how many frames are you able to catch the object…
      remember….the optical flow of opencv works for tracking slow moving objects or more theoretically the feature point (determined by goodfeatures to track..) displacement is less between 2 consecutive frames for the algorithm to work…big displacements will have some erroneous predictions by the algorithm…that is why the speed in the image plane is important..at least qualitatively you should get an idea of it…

    NOTE: both the methods are for single object tracking ..for multiple object tracking you need some modifications…however you can start with either of the method…i think it will work..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

new to c#. I'm trying to make a simple system where I can search
I am trying to use the Qt new functions described here: http://opencv.willowgarage.com/documentation/cpp/qt_new_functions.html#cv-createbutton And I
I am a bit new to opencv. It seems that there are two functions
I'm trying to use new OpenCV feature on Android: native camera access. According to
I'm trying to use the new OpenCV 2.0 API in MS Visual C++ 2008
I'm pretty new to OpenCV and I'm trying to get my bearings by looking
I'm totally new in OpenCV so hopefully that's not a too stupid question. As
I'm new to OpenCV and would like to use its Python binding. When trying
I'm trying to use the new 2.0 c++ version of OpenCV , but everything
I am new to learning openCV and was trying to reproduce an online example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.