Ask Your Question

Remove camera lag in opencv python

asked 2016-12-25 13:23:34 -0600

irum gravatar image

i am working on Odroid and running a face detection using open cv python on it. but there is too much lag in the camera. i have tried a lot of things but couldn't remove the lag. please suggest how can i remove the lag. i want to detect faces from at least 15 feet for that i need a high resolution, but high resolution causes more lag. currently i am having 2 second lag between frames..... if there are any suggestions please share.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-12-26 01:01:08 -0600

berak gravatar image

face detection is slow, and it gets worse with larger images, but you can try to:

  • use a lbp cascade instead of a haar one (they're much faster!)
  • optimize detectMultiScale params ,like:
    • increase the scale factor (less iterations)
    • set a proper maxSize() (again, less iterations)
  • drop frames, now and then. (maybe you do not need to detect a face in each frame)
edit flag offensive delete link more


i think "set a proper maxSize()" should be "set a proper minSize()"

sturkmen gravatar imagesturkmen ( 2016-12-26 02:00:45 -0600 )edit

@sturkmen, i might be wrong, but i assumed, that from 5m away, there will be no "full-image-sized" detections, so you can rule out the "large" faces (which are the most expensive ones)

berak gravatar imageberak ( 2016-12-26 02:15:44 -0600 )edit

Question Tools

1 follower


Asked: 2016-12-25 13:23:34 -0600

Seen: 1,942 times

Last updated: Dec 26 '16