Programmatic control
Beyond the standard IAMCameraControl / IAMVideoProcAmp interfaces, the filter exposes a custom COM interface, IGenicamControl, and its extension IGenicamControl2, so that a host application can drive the camera without any dialog, down to every GenICam (SFNC) feature the camera declares. Both are obtained with QueryInterface on the IBaseFilter of the capture filter; the declarations are in IGenicamControl.h and Guids.h (see the Interface reference).
Typical sequence
#include "IGenicamControl.h"
IBaseFilter* pFilter = ...; // the Datastead GenICam Vision Source capture filter,
// created with CoCreateInstance(CLSID_DtstdGenicamSource, ...)
// or enumerated in CLSID_VideoInputDeviceCategory
IGenicamControl* pCtrl;
pFilter->QueryInterface(IID_IGenicamControl, (void**)&pCtrl);
// 1. before the graph runs: producer, camera, format
pCtrl->SetGenTLProducerPath(L"C:\\Program Files\\Allied Vision\\Vimba X\\cti\\VimbaUSBTL.cti");
pCtrl->SelectCameraBySerial(L"50-0537B12345");
pCtrl->SetPixelFormatPreference(GC_PIXFMT_BGR8);
pCtrl->SetROI(0, 0, 1920, 1080);
pCtrl->SetTriggerMode(0); // free run
// 2. build and run the graph (RenderStream, IMediaControl::Run, ...)
// 3. while streaming: exposure, gain, frame rate
pCtrl->SetExposureTime(5000.0); // microseconds
pCtrl->SetGain(6.0); // dB
pCtrl->SetAcquisitionFrameRate(30.0);
pCtrl->Release();
Before / during streaming
The producer, the camera, the pixel format, the ROI and the binning must be set before the graph reaches the Running state; once capture has started they are fixed for the session. Only the exposure, the gain, the frame rate and the auto modes are meant to change on the fly. Stop the graph to change the rest.
Camera enumeration
int count = 0;
pCtrl->EnumerateCameras(&count);
for (int i = 0; i < count; i++) {
wchar_t serial[64], model[128], iface[128];
pCtrl->GetCameraInfo(i, serial, 64, model, 128, iface, 128);
// ... list "model (serial) on iface" ...
}
pCtrl->SelectCameraByIndex(0); // or SelectCameraBySerial(serial)
EnumerateGenTLProducers / GetGenTLProducerInfo list, in the same way, the .cti producers visible on the current search path (see GenTL producer (.cti)).
Generic GenICam feature access
Every setting the camera declares in its GenICam XML is reachable by its SFNC name, whether or not the filter knows it: the typed accessors of IGenicamControl (SetFeatureInt, GetFeatureFloat, SetFeatureEnum, RunCommand, ...) and the text accessors of IGenicamControl2 (GetFeatureValueString / SetFeatureValueString, which work for every node type).
pCtrl->SetFeatureEnum("ExposureAuto", "Continuous");
pCtrl->SetFeatureFloat("BlackLevel", 4.0);
pCtrl->RunCommand("UserSetSave");
long long temp;
pCtrl->GetFeatureInt("DeviceTemperature", &temp);
IGenicamControl2 also lets the application browse the feature tree the way a vendor viewer does: RefreshFeatureTree snapshots the node map (call it after the camera is open, and again when the pixel format or the streaming state changes, since the access modes are dynamic), then GetFeatureNodeInfo returns the name, display name, category, type, access mode and visibility of each node, GetFeatureEnumEntryList the entries of an enumeration, and GetFeatureRangeString a human-readable range. This is what the Features property page is built on.
User sets
SaveUserSet(index) and LoadUserSet(index) save and restore the camera's own user sets 0..3 (LoadUserSet(-1) loads the factory Default set). They are stored in the camera itself, independently of the settings the filter persists in the registry.
Statistics
GetStats fills a GenicamStats structure with the delivered, dropped, incomplete and erroneous frame counters, the last frame id and the current frame rate; ResetStats clears the counters.
License key
In the licensed version, the license key is passed with IGenicamControl2::SetFeatureValueString(NULL, key), before the graph starts. See License key.