Thread: MJPG lag OpenCV
View Single Post
  #11   Spotlight this post!  
Unread 05-03-2014, 12:47
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,350
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: MJPG lag OpenCV

I've been following this thread for a while with quite a bit of interest.
Although our hardware is different, and our code is not nearly as complex, we to see a small, less than a quarter of a second, amount of lag. It is consistent and doesn't change.

Our hardware is a PCDuino v1, running OpenCV 2.3.1 and processing images from a Microsoft LifeCam over USB.

The question I keep coming back to is, is the camera free running and I am just grabbing a frame as needed, or are we actually requesting each frame one at a time. Here is some pseudo code that shows our approach. (Yash, is this how you are acquiring images?)

Code:
height = 240
width = 320

capture=cv.CaptureFromCAM(-1) ##run from camera
cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH, width)
cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT, height)

while True:
rawImage =cv.QueryFrame(capture)

Do all your processing......

cv.ShowImage('Camera', rawImage)
etc......
I would hope this either just grabs the latest frame from the camera, or requests just one frame. If it is allowing the processor to buffer all the unused frames, then we are SLOWING down the process considerably and need to take a better approach.

Currently we can acquire and process approx. 20 fps. Again, there appears to be about .25 sec. lag between acquisition and display of images.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist