Open TKaluza opened 4 years ago
It is possible to load different xml configuration files into the camera with harvesters.
I'm interested in this, too, but I'm not sure this is part of the GenICam standard. I think an XML file is used to define the camera parameters (addresses, min/max, etc), but not for actual user values for a particular application.
You might be interested in the User Set Controls in the SFNC if you aren't already familiar with these.
I'm interested in this, too, but I'm not sure this is part of the GenICam standard. I think an XML file is used to define the camera parameters (addresses, min/max, etc), but not for actual user values for a particular application.
I don't mean this to be rude, but if it only exists to define the camera parameters then why should I be able to load an external xml file? Are there cameras that do not "share" their xml file?
For example within the bexplorer of baumer I can export an xml file. More or less I'm just interessted to have something of a profile I could handle. When doing measurements in a study I would like to save a profile of the current setting of the camera (and the lenses, etc) to be able to repeat the same study again. But I cannot save all those settings of all studies within the same camera. 3 User Profiles are not enough :smiley:
You might be interested in the User Set Controls in the SFNC if you aren't already familiar with these. Thank you for the link :+1: . I'm already using it.
Of course I'm absolutely okay with it being a feature which is not to be implemented, because it doesn't fit in (I would appreciate a reason for it ). Then I can create my on wrapper for settings saving and loading - or it least I could try :laughing:
Just to be clear, I am just another user, and I am new to harvesters! I think it would be a great feature to have, and I am basically writing it for my project already. So I could potentially help with this feature. Would you be able to upload an xml file from bexplorer as an example?
I think it would be a great feature to have, even if it is not in GenAPI. It will be informative when @kazunarikudo is able to chime in. I don't if adding features to harvesters that are not in the standard is okay, or if I even understand the standard well-enough.
if it only exists to define the camera parameters then why should I be able to load an external xml file?
I think I know why this is, but I'm not very confident. This could be entirely wrong. NodeMap.load_xml_from_file
comes from the genicam.genapi.NodeMap
class, and I think harvesters or genapi uses it internally to setup the node_map
. I think it is only exposed to harvesters users because harvesters is such a light wapper around GenAPI. Same as the nodemap.connect
method, for example. If I understand correctly, I do think it would lead to less confusion if it were private or otherwise not available to users.
Just to be clear, I am just another user, and I am new to harvesters! I think it would be a great feature to have, and I am basically writing it for my project already. So I could potentially help with this feature.
I have sometimes problems with writing "friendly" English. I totally appreciate your answers and clarification.
Would you be able to upload an xml file from bexplorer as an example?
Can you share that part? I'll look through the XML but I don't see a reason yet why I shouldn't be able to upload it. (So I probably will. Where to?)
Also if your doing this and if I may add my two cents: Why not using YAML (or structured json) instead of XML for saving the options. I see no reason to stick to XML.
I think I know why this is, but I'm not very confident. This could be entirely wrong.
NodeMap.load_xml_from_file
comes from thegenicam.genapi.NodeMap
class, and I think harvesters or genapi uses it internally to setup thenode_map
. I think it is only exposed to harvesters users because harvesters is such a light wapper around GenAPI. Same as thenodemap.connect
method, for example. If I understand correctly, I do think it would lead to less confusion if it were private or otherwise not available to users.
I think you may be absolutely right. Thank you :smile:
Ah, I'm not sure. Maybe pastebin? As for format, we use flat ini files, so that's the wrapper I am writing, but that's another thing I would wait for some input from @kazunarikudo about. It's hard to imagine GenICam using anything but nested xml.
@TKaluza Hi.
current camera settings to .xml
The feature can be supported by GenApi C++ itself. However, I have not ported the feature to Python genapi
package. Maybe it's a good motivation to work on it for the next release. The feature offers you to store/load a set of streamable GenICam feature node values from/to the device.
It's totally fine to write software that achieves and I do not care what format is used; that is absolutely the right approach that you can take as Jeffery has done. I just like to stick with the native GenApi because it reduces where I have to take care. If I implement the feature in Harvester then I will have to keep taking care of consistency.
Anyway, I will try to work on it in the near future but the release timing of the genapi
package is limited (twice per year in general) and I can't guarantee comes up in a month or two. We as the GenICam committee are going to have an annual meeting at the end of this May. I will try to speak about this in public during the session that I lead.
/Kazunari
@TKaluza
Thank you very much for your effort, I do like harvesters
I'm happy to heat that you like Harvester. Thanks!
@TKaluza Ha. Well, there you have it, I was wrong.
@kazunarikudo Can you point to where it is in the GenApi C++ library? What it is called and what the format is, so that I can understand this better?
Are you interested in any help? I will be implementing this for my project in the next week or two either way. I can write C++ and/or python.
@jmilloy Hi, Jeffery. Thank you for your offer but we would like to develop the GenICam Python binding, the genicam
package, following our manner. The software libraries that the GenICam committee releases are maintained by core companies because we need to take care of delicate points such as compatibility. It is not realistic to open everything to everybody. I hope you understand our policy that we are keeping for 15 years.
Can you point to where it is in the GenApi C++ library?
GenApi has a class called CFeatureBag
and it offers you the following methods; see include/GenApi/Persistence.h
if you have a copy of the source package:
int64_t StoreToBag(INodeMap *pNodeMap, const int MaxNumPersistSkriptEntries = -1, GENICAM_NAMESPACE::gcstring_vector *pFeatureFilter = NULL);
bool LoadFromBag(INodeMap *pNodeMap, bool Verify = true, GENICAM_NAMESPACE::gcstring_vector *pErrorList = NULL);
The first one is used to store the streamable feature node values to the CFeatureBag
object and the latter one is used to get the values back to the given node map object. CFeatureBag
supports the <<
operator to write the holding values to a std::stringstream
object that allows a user to keep the values in a file.
The beauty of this feature is it does not require users to think about any minor esoteric manipulation that the camera requires internally; I guess you understand it does not work at all even if you just write a sequence of values to the given node map object because it requires you so many things such as taking care of selectors or the order to write, etc. Just calling the latter method, the node map, i.e., the camera understands how the values should be applied.
Until I finish to port CFeatureBag
to the genicam
package, it'd be realistic to create a file that holds a set of feature values for a specific model if a Harvester user wants to store/load a set of feature values as you have done by yourself. It's totally fine to extend the functionality, such as making it more generic so that it works for many cameras, but you'd probably have a chance where you get choked up with a minor difference in the compatibility.
Thank you again for your kind offer but I hope you understand there's a strict rule. /Kazunari
Okay, I understand.
@kazunarikudo any update on this? It would be really nice to allow users to modify and upload an XML file rather than having to add support for each feature we'd like to configure to our usage of Harvesters.
Hello, I have written a small script that shows how to apply and save settings from a yaml file. Hopefully it will give a nice starting other people looking at this issue!
The approach is inspired by the harvester gui and specifically the attribute controller.
The settings are not hard coded so this should be able to be used by whatever camera has genicam capabilities.
how to use:
The script is in python so you need to change the extension to get it to work. Github does not allow me to upload python though.
Is your feature request related to a problem? Please describe. It is possible to load different xml configuration files into the camera with harvesters. But (sorry if I overlooked it!) I do not find any information if and how to export a .xml file within harvesters.
Describe the solution you'd like Add a method for easily saving a xml file, that also could be loaded again. More preferred I would also like a option if, the path is defined, the latest xml version isn't delete when the image acquirer is destroyed.
Describe alternatives you've considered
xml_dir_to_store
but the methods using it a "private". https://github.com/genicam/harvesters/blob/d4d65f5e58603949d82569f5a845b311ca7137e9/src/harvesters/core.py#L3002Additional context If any needed please ask. Thank you very much for your effort, I do like harvesters