Closed EllingEye closed 2 years ago
Hi @EllingEye
I am sorry to say but at the moment we do not have good way of reading settings from a yaml file using zivid-python
. I have created an internal ticket for this issue.
That's okay. I'll just trow something together with pyyaml. Just wanted to check if a solution already existed. Thank you for the quick reply.
I ran into the same issue. This seems to do the job in 2.1.3.2.4.1:
import zivid
import _zivid
import zivid._settings_converter as _settings_converter
(...)
app = zivid.Application()
(...)
internal_settings = _zivid.Settings('/path/to/settings.yml')
settings = _settings_converter.to_settings(internal_settings)
Looking forward to the official support of this functionality :)
Yes that should do the trick for now.
One warning: You will get inconsistent result if the yml contains values for the settings in the Zivid API that are not yet supported in the Python front-end, such as Settings::Color::Experimental::ToneMapping
and Settings::Experimental::Engine
. You will experience that those values will be lost in translation, and be reverted to their default values when you capture. This will be fixed by the time we provide this as official functionality, of course. If you stay away from those settings, things should be fine when using your workaround.
Good news, @erikschuitema and @EllingEye : This is now an official feature. You can do stuff like:
settings = zivid.Settings.load("settings.yml")
settings.save("new_settings.yml")
This will work will all data-models like Settings, Settings2D, FrameInfo, CameraState, etc.
You can get this from master branch now, or wait for the next PyPI release in a few days.
This is now officially released to PyPI.
Is it possible to load the exported settings from Zivid Studio in python? I've found an example showing how to do this in c++:
const auto settingsFile = std::string(ZIVID_SAMPLE_DATA_DIR) + "/Settings/" + cameraModel + "/Settings01.yml"; const auto settings = Zivid::Settings(settingsFile);
But I haven't found a way to do the same with the zivid.Settings()-class in python