OpenNI2Grabber way to detect ONI stream end of file

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenNI2Grabber way to detect ONI stream end of file

Alexander Görtz
Hi,

Is it possible to detect the end of the oni stream if read by the
OpenNI2Grabber?
After my small patch here: https://github.com/PointCloudLibrary/pcl/pull/837
The pointclouds look a lot better but if I don't manually stop the grabber
after the end of the oni stream it eats up all my memory and I found no way to
determine the last frame. Currently I use the NiViewer to "see" how many
frames the stream has and have a variable that is counted up on every frame.
This is really not a nice solution so any ideas are welcome.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Dabox
This post was updated on .
Strange that  grabber->hasDataLeft () is not implemented.
I would suggest to just check if the returned frame is valid.
Could you show a code example?
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Alexander Görtz
> Is grabber->hasDataLeft () not working or implemented?
No, it's not but a good hint, maybe I'll have a look at the oni_grabber.cpp
(which is not working with oni files created by OpenNI2) how it is implemented
there or in the openni_device_oni.cpp maybe this will give me a hint how to
check for the end of the stream.

I guess I figured out what happens after the stream reached it's end OpenNi
loops it and the PCL implementation misses that and creates new clouds in the
ram but does not call the callback functions to get rid of them. I figured
that out because the Image Callback works after the stream ends and repeats
again and again.

Am Freitag, 8. August 2014, 02:32:43 schrieb Dabox:

> Is grabber->hasDataLeft () not working or implemented?
>
>
>
> --
> View this message in context:
> http://www.pcl-users.org/OpenNI2Grabber-way-to-detect-ONI-stream-end-of-fil
> e-tp4035085p4035094.html Sent from the Point Cloud Library (PCL) Users
> mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Dabox
This post was updated on .
Alexander Görtz wrote
>
(which is not working with oni files created by OpenNI2)
Yeah, had the same problem. I am using the grabber for openni1 and there you have the method to check if the stream ended. Probably you could just check how it works and use that method.
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Dabox
What is your actual soluton to get the frame num?
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Alexander Görtz
> What is your actual soluton to get the frame num?

It's not really a solution, as I said in my first post I use the NiViewer set
playbackspeed to x64 and press P to see the current frame number. In my code I
have a hardcoded constant that is checked against my counter. Really if feel
awkward admitting to such a practice ;).


Am Freitag, 8. August 2014, 06:31:55 schrieb Dabox:

> What is your actual soluton to get the frame num?
>
>
>
> --
> View this message in context:
> http://www.pcl-users.org/OpenNI2Grabber-way-to-detect-ONI-stream-end-of-fil
> e-tp4035085p4035099.html Sent from the Point Cloud Library (PCL) Users
> mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Dabox
Ahah ok, thought you found a nice way to get the frame number from the stream :)
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

kwaegel
Administrator
Sorry for all the problems with reading to the end of a file stream. I started implementing that, but never pushed the changes upstream due to significant remaining bugs.

Dabox wrote
Ahah ok, thought you found a nice way to get the frame number from the stream :)
Doesn't DepthImage::getFrameID() do what you want? That's just a wrapper for the OpenNI2 frame index.

If you want to know how many frames an OpenNI2 recording contains from the start, you may need to add something like openni_device_->getPlaybackControl()->[getFrameCount] inside openni_device.cpp to access that data.

(I would normally just go ahead and finish adding file support, but I'm starting a new job and don't know when I'll have time.)
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Alexander Görtz
Hi,

> Doesn't *DepthImage::getFrameID()* do what you want? That's just a wrapper
> for the OpenNI2 frame index.
>
> If you want to know how many frames an OpenNI2 recording contains from the
> start, you may need to add something like
> *openni_device_->getPlaybackControl()->[getFrameCount]* inside
> openni_device.cpp to access that data.
been there, done that :P
I have added functions to the device to get the framecount and wrote the
frameID to the cloud header and submitted pull requests which are partly
allready in upstream git. And they made me add doxygen comments to my
functions :P.
Currently I have a new Problem that my app crashes on close because I could
not find a good solution to wait for the grabber threads to finish before I
destroy my application. But that is another Problem ;)
Nice to see that you are still on the mailing list.

Am Montag, 8. September 2014, 15:04:37 schrieb kwaegel:

> Sorry for all the problems with reading to the end of a file stream. I
> started implementing that, but never pushed the changes upstream due to
> significant remaining bugs.
>
>
> Dabox wrote
>
> > Ahah ok, thought you found a nice way to get the frame number from the
> > stream :)
>
> Doesn't *DepthImage::getFrameID()* do what you want? That's just a wrapper
> for the OpenNI2 frame index.
>
> If you want to know how many frames an OpenNI2 recording contains from the
> start, you may need to add something like
> *openni_device_->getPlaybackControl()->[getFrameCount]* inside
> openni_device.cpp to access that data.
>
> (I would normally just go ahead and finish adding file support, but I'm
> starting a new job and don't know when I'll have time.)
>
>
>
> --
> View this message in context:
> http://www.pcl-users.org/OpenNI2Grabber-way-to-detect-ONI-stream-end-of-fil
> e-tp4035085p4035448.html Sent from the Point Cloud Library (PCL) Users
> mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: OpenNI2Grabber way to detect ONI stream end of file

Dabox
Thanks, I solved using:

device_.getPlaybackControl()->getNumberOfFrames(ir_)

where device_ is of type openni::Device
and ir_ is of type openni::VideoStream

I used directly openni2 and not the pcl wrapper