Get skeleton from a .bag recording

I want to compare the performance of two cameras (Intel L515 and D455) with the nuitrack SDK. Is it possible to run nuitrack.get_skeleton() in python on a recording (.bag file) made with each camera?

I cannot find any documentation on the topic.

Thank you!

Hi @Lossim

You can run bag file by setting it’s path using nuitrack.set_config_value

nuitrack.init()
// use it after init
nuitrack.set_config_value("Realsense2Module.FileRecord", "absolute/path/to/bag")

HI @Lossim

Has your issue been solved? Do you have any other questions left?

Hi @a.bragin,
I modified the code for python and added the set_config_value line above. This looks like it works, but then it cannot access most of the main loop,

nuitrack.set_config_value("Realsense2Module.FileRecord", "C:/Users/etc")
nuitrack.run()
Then I start the while loop

The waitkey works in the loop but then the loop suddenly exits at nuitrack.update() or at nuitrak.get_skeleton() if I remove the update().

Thanks!

btw I am new to this kind of platform so let me know if I can improve my answers/syntax

Hi @Lossim

  1. Make sure you follow Python code example.
  2. Make sure you set correct path to your bag file and you use nuitrack.set_config_value right after nuitrack.init, i.e.
# snippet from official example

...

def draw_skeleton(image):
	point_color = (59, 164, 0)
	for skel in data.skeletons:
		for el in skel[1:]:
			x = (round(el.projection[0]), round(el.projection[1]))
			cv2.circle(image, x, 8, point_color, -1)

nuitrack = py_nuitrack.Nuitrack()
nuitrack.init()

nuitrack.set_config_value("Realsense2Module.FileRecord", "C:/Users/alexey/Desktop/test/test.bag")

# ---enable if you want to use face tracking---
# nuitrack.set_config_value("Faces.ToUse", "true")
# nuitrack.set_config_value("DepthProvider.Depth2ColorRegistration", "true")

devices = nuitrack.get_device_list()

...

  1. Make sure you’ve activated Trial license. Recordings (bag/oni) work either w/o license (for 3sec)
    or with Trial license (for 3min)

Thanks the technique worked, I didnt realize I needed a device even though I was reading from a file!
The nuitrack.update() function takes a bit more than 2 seconds to run while everything else in the loop runs in <20 milliseconds. Is this something inherent to .bag files or is there a way to make it faster?

Hi @a.bragin,
Follow up on the question above, is there another function that can replace nuitrack.update()?
Thanks!

Hi @Lossim

Update is absolutely necessary as it fetches data from Nuitrack modules, but it should not take more than 33 ms, as it is designed to work in real time.

Do you use our sample or your own modification? If you provide a faulty piece of code with could investigate the problem

Hi @Lossim

Do you have any new questions?

Hi Alexey,
Sorry for the delay I was out of office. It’s good to know that it should take 33ms, I will evaluate the code and will send you a faulty piece of code if I can’t figure it out.
Thank you!

Hi @Lossim

Understood, let me know if you have any questions.