OpenNI / OpenNI2

OpenNI2
Apache License 2.0
435 stars 891 forks source link

Fix kinect recording oni for NiTE 2.2 #80

Open KHeresy opened 10 years ago

KHeresy commented 10 years ago

The ONI file recorded from Kinect sensor can't work with NiTE 2.2 because leak the property XN_STREAM_PROPERTY_PARAM_COEFF.

This patch fix this issue.

KHeresy commented 10 years ago

The pre-build dll could be download here https://github.com/KHeresy/OpenNI2/releases/tag/KinectOniFix

Just replace original kinect.dll in OpenNI2\drivers It should works for both OpenNI 2.2 and 2.3

piedar commented 10 years ago

I think this repo has been abandoned. You should also make a pull request to occipital/OpenNI2.

KHeresy commented 10 years ago

Here is a small program to fix existed ONI files

https://github.com/VIML/oniFixer

It use the VirtualDeviceForOpenNI2 project (https://github.com/VIML/VirtualDeviceForOpenNI2), open the exist ONI file and create a virtual device to record it again with all required properties.

huangfuyang commented 10 years ago

Why ignored by primesense? It is a critical bug which causes corruption each time when you play an ONI file under NITE. Previously, I just manually set XN_STREAM_PROPERTY_PARAM_COEFF to 4. PS. Thank you Hersey. I learn a lot from your tutorial.

tomoto commented 10 years ago

See https://github.com/OpenNI/OpenNI2/issues/83 . What do you think, Heresy, Benn?

KHeresy commented 10 years ago

to piedar

Thanks for reminding. I know occipital start to handle the OpenNI C++ code. I didn't make pull request to them just because I didn't merge there updated code first.

davudadiguezel commented 9 years ago

hi, I managed to get your VirtualDevice running on Linux (kubuntu 14.04), but Nite2 seems to have a hard time finding users in recordings. Sometimes it doesn't find any, sometimes it takes half the recording to find some and sometimes it loses them right after finding them. I guess, the problem is somewhere in the VirtualDevice, because I found a .oni file somewhere in the internet and Nite2 is tracking fine on it. But when I send the same file through the VirtualDevice no user is found. Does somebody have any ieda to that problem?

KHeresy commented 9 years ago

When using VirtualDevice , it may make the duration between frame and frame increase, depend on what you do with each frame. This may make NiTE hard to tracking.

I think you may try to reduce the computational complexity, and check if it work better.

davudadiguezel commented 9 years ago

hey heresy, thanks for the replay. Right know I am using the UserViewer Sample that comes with Nite2 and combine it with your Nite Sample and the virtual device. I feed Nite with a virtual device that comes with properties copied from a real device and depth data from the actual .oni file that I want to run with nite. I also have an .oni file from somewhere in the internet that I can give directly to nite and it's working like a charm. When I pipe it through your virtual device no skeleton is tracked at all. I tried to find complexity, that I could eliminate, without any real success. All I am doing is load the devices and copy parameters and data. I also use this function to copy framedata: openni::DepthPixel* pImg1 = reinterpret_cast(rF1.data); openni::DepthPixel* pImg2 = reinterpret_cast(rF2.data);

int dataSize=rF1.dataSize; memcpy(pImg2,pImg1,(size_t)dataSize); I found it here: https://getsatisfaction.com/openni/topics/nite2_usertracker_crashes_when_reading_from_oni_files The function that came with your samples didn't work unfortunatly. Do you have any other idea why the tracking performance is so bad on recordings for me?

davudadiguezel commented 9 years ago

ok. previously I fetched the .oni file from my network and was a bit slower than data from the kinect. now I get it from local files, that is even a little faster than kinect, but still not tracking.

davudadiguezel commented 9 years ago

Also tried to get it the framerate at the same speed as with kinect, but didn't improve tracking either. Do you have any other ideas on why it's not working?

KHeresy commented 9 years ago

If what you need is just make ONI work with NiTE, I would recommend try use KinectOniFix to process the ONI file before use it. https://github.com/KHeresy/OpenNI2/releases/tag/KinectOniFix In this way, you don't need to use VirtualDevice in your code.

davudadiguezel commented 9 years ago

I tried that, too, but when it reaches the point where it wants to close the physical device it stops without any error message. Just doesn't do anything anymore. Furthermore I need not to do only .oni files, but also .bmp recorded with the old kinect. I used your virtual device for this and it worked partualy. Lately I found out, that these old kinect .bmp - files where recorded with only 7 fps. Sorry, that late information, but I learned about it myself just the other day. Could this be the reason for the bad performance and can I somehow cope with it? I already tried to reduce fps on my virtual device and any other stream without any success.

KHeresy commented 9 years ago

NiTE is a black box, it has lots of usage limits. For example, it only accepts some resolutions(VGA, QVGA).

I am not sure what would happen if you give it 7fps depth data.

davudadiguezel commented 9 years ago

ok. thanks anyway.