Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion libfreenect dropping depth frame when I block main
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
drew.m.fisher@gmail.com  
View profile  
 More options Apr 22 2012, 12:04 pm
From: "drew.m.fis...@gmail.com" <drew.m.fis...@gmail.com>
Date: Sun, 22 Apr 2012 09:04:43 -0700
Local: Sun, Apr 22 2012 12:04 pm
Subject: Re: [OpenKinect] libfreenect dropping depth frame when I block main

On Sun, Apr 22, 2012 at 07:12, Troy Boswell <troy.boswe...@gmail.com> wrote:
> I am new to concurrent processing but I am wondering if someone can explain why libfreenect drops frames if I put a blocking function in main(). A good example is the opencv example, if cvwaitkey blocks for more than 5ms then libfreenect will drop frames. Thus you surely cannot use this function to block waiting for a key press (cvwaitkey(0)) or libfreenect will drops frames like crazy. I suspect it has something to do with usb timing. Maybe the callback blocks if main is block, any insight would be helpful. I am only concerned as I only need to periodically capture frames, if I could block main() for a period of time and let libfreenect do its thing it would reduce my cpu usage as I currently have to sit main in a while loop simply burning cpu time.

libfreenect never runs or handles any packets unless you're actively
calling freenect_process_events().  It does not internally fork a
thread.  So if you don't give it CPU time (by calling
freenect_process_events()) before the kernel fills up all the
isochronous buffers we've queued to store the data streaming from the
Kinect, then data will be lost, which will likely result in framedrop.

The usual solution is to spawn a thread which calls
freenect_process_events(), which is how the freenect_sync wrapper
works internally.  Since you mentioned opencv, you might also be
interested in the libfreenect opencv wrapper, which wraps the
freenect_sync wrapper - take a look at wrappers/opencv/cvdemo.c for
example usage.  With that API, you should be able to simply call
freenect_sync_get_depth_cv whenever you want to capture a frame - the
first time it is called, it will launch a separate thread running a
libfreenect mainloop.

Hope that helps explain things!

-Drew


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.