<< Click to Display Table of Contents >> Navigation: Image Manager > CVB Technology > GenICam and CV GenAPI > Introduction GeniCam Library |
The CV Gen API which is an interface from CVB to GenICam™ deals with the problem of how to configure a camera. The key idea is to make camera manufacturers provide machine readable versions of the manuals for their cameras. These camera description files contain all of the required information to automatically map a camera’s features to its registers.
A typical feature would be the camera’s Exposuretime and the user’s attempt might be, for example, to set the Exposuretime to 20ms. Using the CV Gen API, it is possible to write the Exposuretime to the camera without the need to know in which register it is written. This can be realized with 3 lines of very easy readable code.
Other tasks involved might be to check in advance whether the camera possesses a Exposuretime feature and to check whether the new value is consistent with the allowed Exposuretime range.
If you want to use the CV Gen API you have to give the API access to a NodeMap from a GenICam™ compliant Camera.
First you have to load a VIN driver which supports the NodeMapHandle Interface.
For Example the GenICam.vin driver which supports this Interface.
Then you can check if the loaded vin-Driver can get a NodeMap with CanNodeMapHandle.
After that you can get the NodeMap from the Camera with NMHGetNodeMap as a CVB NodeMap handle.
Get the NodeName of the FeatureTo access features from the NodeMap you need the name of the node. You can get the name of the node when you open an application like the Common Vision Blox Management Console which uses the CV GenApi Grid Control. With this you can find the feature and read out the name from the description area on the bottom part of the Grid Control. E.g. Std::ExposureTimeAbs for the Exposure Time. You can double click on the feature name and the name except the namespace (Std::) is marked. Then you can copy it to the clipboard and the paste it to your code.
The namespace is not needed to access features with the CV Gen API. Only if features exists with the same name in different namespaces. Then you have to access the feature with the namespace. Otherwise the standard feature (Std::) is preferred against a custom feature (Cust::). |
|
// Check if INodemap interface is available
if (CanNodeMapHandle((IMG)m_cvImg.GetImage()))
{
// Get NodeMap from Camera
NMHGetNodeMap((IMG)m_cvImg.GetImage(), NodeMap);
}
// Set the Exposuretime to 20ms
// Get ExposureTimeNode (e.g. With the Standard feature name "ExposureTimeAbs")
NODE ExposureTimeNode = 0;
NMGetNode(NodeMap, "ExposureTimeAbs", ExposureTimeNode);
// Set the Exposuretime
NSetAsString(ExposureTimeNode, "20000");
// Check if INodemap interface is available
if (Cvb.Driver.INodeMapHandle.CanNodeMapHandle((Cvb.Image.IMG)m_cvImage.Image))
{
// Get NodeMap from Camera
Cvb.Driver.INodeMapHandle.NMHGetNodeMap((Cvb.Image.IMG)m_cvImage.Image, out NodeMap);
}
// Set the Exposuretime to 20ms
// Get ExposureTimeNode (e.g. With the Standard feature name "ExposureTimeAbs")
GenApi.NODE ExposureTimeNode = 0;
GenApi.NMGetNode(NodeMap,"ExposureTimeAbs", out ExposureTimeNode);
// Set the Exposuretime
GenApi.NSetAsInteger(ExposureTimeNode,20000);
Examples
Visual C++ |
|
CSharp |