BrianOfrim / gstreamer-pyspin-src

GStreamer source plug-in for the FLIR Spinnaker Python SDK (PySpin) [Unofficial]
MIT License
15 stars 3 forks source link

pyobject initialization failed #2

Closed martiege closed 3 years ago

martiege commented 4 years ago

Versions: Ubuntu 16.04.6 LTS (GNU/Linux 4.4.38-tegra aarch64) gst-inspect-1.0 version 1.8.3 GStreamer 1.8.3 Python 3.6.3

I've followed your installation guide, but was unable to install gstreamer1.0-gl, gstreamer1.0-gtk3 and gstreamer1.0-qt5.

When trying the command: gst-inspect-1.0 pyspinsrc

I get ** (gst-plugin-scanner:8512): CRITICAL **: pygobject initialization failed No such element or plugin 'pyspinsrc'

Testing the pyspinsrc.py file, and when creating an instance of PySpinSrc, I get: ** (pyspinsrc.py:8544): CRITICAL **: gst_base_src_init: assertion 'pad_template != NULL' failed

Any idea what I can do to fix this?

BrianOfrim commented 4 years ago

Hi @martiege , Thanks for your interest in this repo. So far I have only tried this on Ubuntu 18.04 with GStreamer 1.14 for both x64 and arm64. Are you using a Nvidia Tx2? I can probably get access to a Tx2 to try this out on Ubuntu 16.04 for arm64 at some point in the future and see what the issue might be. In the meantime as an alternative to using the pyspinsrc plugin I would recommend using the aravissrc gstreamer plugin from https://github.com/AravisProject/aravis as Aravis should be compatible with FLIR machine vision cameras as well.

martiege commented 4 years ago

Thank you for the quick reply! Yes, I'm using a Nvidia TX2 with Ubuntu 16.04. My guess is that the GStreamer version available by using the normal "apt-get install" method is too old to be compatible with the python bindings, so I've tried to build GStreamer from source, though this has come with some other headaches...

I've worked with Aravis some earlier, and it works well, but my goal is to use hardware trigging to control the framerate using a separate device, and I haven't been able to get this to work with Aravis. This is why I was interested in this repo, there is way less code, and I also think it's way more readable, and it would be easy to rewrite parts of the plugin to enable hardware trigging.

Do you know anything about how to use hardware trigging with Aravis? Otherwise I think my best bet is to write a new C-plugin for GStreamer. (Though the template for C seems more daunting than Python, and just adapting your existing plugin would be very quick... Oh well)

This repo seems really nice, and worked perfectly when I tested it on my desktop using the same versions as you.

BrianOfrim commented 4 years ago

Hi @martiege, For FLIR machine vision cameras that are compatible with Spinnaker it should be possible to save the hardware triggering setting to UserSet0/1 and then set UserSetDefault to UserSet0/1 so that the hardware trigger settings will be loaded when the camera is powered on. You can use the SpinView utility to configure the settings and then set UserSetSelector to UserSet0/1, execute UserSetSave, and then set UserSetDefault to UserSet0/1. This should allow you to hardware trigger the camera with the aravis GStreamer source unless it changes trigger settings. Not sure if that will work or not but it is worth a try.

With pyspinsrc there is the property "user-set", the default value for this is "Default" so if it is not changed then the camera's default settings are loaded every time the plug-in is ran and then the other pyspinsrc properties ("exposure", "gain") are applied after the user set is loaded. So you could try changing the property "user-set" to "UserSet0" if you have saved the hardware trigger settings to "UserSet0".

martiege commented 4 years ago

Oh that's true, I had not considered that. So it should be possible to have one program to set the Spinnaker SDK to hardware trigging, and then use Aravis to transport the resulting data? The only things I tried were based on the examples in the Spinnaker library, which reset the trigger at the end of the program, but it makes sense that this should be configurable outside one program, as the cameras are separate to the code... I'll try it out. Thank you for the help!

BrianOfrim commented 4 years ago

@martiege Saving the settings to UserSet will make them persist across camera power cycles. So you would just need to configure the camera with the correct settings once with Spinnaker, save them to a UserSet and then set that UserSet as UserSetDefault. Then you can go ahead and use the camera in Aravis after that and the settings from the userset should still be applied. So you will not need to use Spinnaker and Aravis at the same time.

martiege commented 4 years ago

Right, that seems very useful, I'll try it out, thank you!