ibaiGorordo / pyKinectAzure

Python library to run Kinect Azure DK SDK functions
MIT License
454 stars 113 forks source link

Running Playback on synced .mkv files. #54

Closed juansolana closed 1 year ago

juansolana commented 2 years ago

Hi! I tried running the examplePlaybackBodyTracker.py file using an mkv file from a synced recording I did using k4arecorder.

I'm getting the following error: [2022-03-15 11:59:44.460] [error] [t=24870] /__w/1/s/extern/Azure-Kinect-Sensor-SDK/src/image/image.c (51): k4a_image_t_get_context(). Invalid k4a_image_t (nil) [2022-03-15 11:59:44.460] [error] [t=24870] /__w/1/s/extern/Azure-Kinect-Sensor-SDK/src/image/image.c (389): Invalid argument to image_get_buffer(). image_handle ((nil)) is not a valid handle of type k4a_image_t [2022-03-15 11:59:44.460] [error] [t=24870] [K4ABT] ../src/TrackerHost/DepthFrameBlobK4A.cpp (13): Initialize(). Get depth buffer from the capture handle failed! [2022-03-15 11:59:44.460] [error] [t=24870] [K4ABT] ../src/TrackerHost/TrackerHost.cpp (275): EnqueueCapture(). Initialize DepthFrameBlob failed! Body tracker capture enqueue failed! File "examplePlaybackBodyTracker.py", line 32, in <module> body_frame = bodyTracker.update(capture=capture) File "../pykinect_azure/k4abt/tracker.py", line 36, in update self.enqueue_capture(capture.handle(), timeout_in_ms) File "../pykinect_azure/k4abt/tracker.py", line 43, in enqueue_capture _k4abt.VERIFY(_k4abt.k4abt_tracker_enqueue_capture(self._handle, capture_handle, timeout_in_ms), "Body tracker capture enqueue failed!") File "../pykinect_azure/k4abt/_k4abt.py", line 157, in VERIFY traceback.print_stack()

For some reason when it starts capturing frames from the mkv file it is empty. This only happen with synced mkv files, if I do it with a recording without synching the kinects, it works fine.

I'm just getting familiar with the code, do you ahve any idea how it could be fixed?

Thanks!

ibaiGorordo commented 2 years ago

I only have one Kinect camera, so I have not tested it. I probably missed some part that is different when using sync cameras, but it is hard to tell since I cannot test it.

LinyeLi60 commented 2 years ago

The problem is that the playback.isOpened() will first get next capture and go back to the previous capture, if mkv file is not full 30fps, some capture may lost. So you can replace while playback.isOpened() by while True. Also check if the fps of depth image is consistent with color image, it will also cause problems.