zivid / zivid-python

Official Python package for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
40 stars 14 forks source link

Dificult to duplicate settings #13

Closed SatjaSivcev closed 3 years ago

SatjaSivcev commented 5 years ago

To configure the settings for an HDR image that has three frames it is necessary to configure each frame separately, e.g. settingscollection = [camera.settings for in range(3)] settings_collection[0].iris = 10 settings_collection[0].filters.gaussian.enabled = True settings_collection[0].gain = 2 settings_collection[1].iris = 10 settings_collection[1].filters.gaussian.enabled = True settings_collection[1].gain = 3 settings_collection[2].iris = 10 settings_collection[2].gain = 4 settings_collection[2].filters.gaussian.enabled = True

It would be handy if it was possible to configure the settings for a single frame and then duplicate those settings with clone() or copy(), e.g. settings = camera.settings settings.iris = 10 settings.gain = 2 settings..filters.gaussian.enabled = True settings_collection = [settings, settings.clone(), settings.copy()] settings_collection[1].gain = 3 settings_collection[2].gain = 4

The point is that a lot of settings for different frames will be the same so why would it be necessary to configure each setting of each frame separately.

eskaur commented 4 years ago

While less elegant, you could do this: import copy new_settings = copy.deepcopy(settings)

SatjaSivcev commented 4 years ago

Isn't this what I did in the first place but we decided it is not good for some reason? @trym-b

eskaur commented 4 years ago

I talked to him. It works for now, but it may stop working in the future once the internal workings of zivid.Settings is changed. It is definitely a good idea to add some settings.clone() in the future.

SatjaSivcev commented 4 years ago

Does that mean we don't modify it for now to what you recommended?

trym-b commented 4 years ago

The use of copy.deepcopy is discouraged, since we are planing on implementing the settings system with a pointer to the underlying cpp settings object. If you call copy.deepcopy on such an object you will only clone the pointer, and not create a new object.