Please enable JavaScript to view this site.

IDS peak 2.8.0 / uEye+ firmware 3.33

Using IDS peak API, you can open connected cameras and make them available for parameterization and image acquisition. A camera is represented as a so-called "Device". Devices are connected to the System via Interfaces. In this context, Interfaces represent the physical connections of the camera, e.g. the USB or GigE connection. The System represents the software driver. Several Interfaces can be addressed by one System, also several Devices can be connected to one Interface.

Fig. 272: System, Interface, and Device

Fig. 272: System, Interface, and Device

If you want to open a camera, you must first determine which cameras (Devices) are connected and how the cameras are assigned in this structure. This task is performed by the "DeviceManager" class. The DeviceManager detects all available Systems, Interfaces and Devices. The global DeviceManager is accessible via the Instance() function.

Update

The DeviceManager searches the System for connected cameras using the Update() function. The DeviceManager scans for available modules and stores them in the lists Systems(), Interfaces() and Devices().

hint_info

A simple example how to use the DeviceManager can be found in the sample "open_camera".

Devices

You can query the found cameras (Devices) in the vector Devices(). Here, the cameras are represented in the form of descriptors that allow certain information to be accessed even if the cameras are not opened yet.

genericC++

auto devices = deviceManager.Devices();

The length of the vector corresponds to the number of cameras found. A camera can be listed multiple times, e.g. if it can be opened via several transport layers.

genericC++

auto deviceCount = deviceManager.Devices().size();

Opening a camera

In the simplest case, the first camera found is opened. Do this by executing the OpenDevice() function of the Device descriptor. Here, the access type is passed, e.g. "Control", "Exclusive" or "ReadOnly".

The selected camera is now open and can be used.

hint_info

How to close a camera is described in Closing a camera (API).

Alternatives and variations: Opening a camera with a specific serial number

First, iterate over the found cameras in the list. Then, compare the given serial number with the serial number of the camera in the list. If the serial number is found, the camera is opened and a Device object is created.

genericC++

std::string serNo = "123456789";
std::shared_ptr<peak::core::Device> device = nullptr;
 
auto& deviceManager = peak::DeviceManager::Instance();
deviceManager.Update();
 
for (const auto& descriptor: deviceManager.Devices())
{
  if (descriptor->SerialNumber() == serNo)
  {
      device = descriptor->OpenDevice(peak::core::DeviceAccessType::Control);
      break;
  }
}
 
if (device)
{
  // ...
}

Alternatives and variations: Opening a camera with a specific IP address

The IP address of the camera must be specified as an integer value. Usually, there are conversion functions in the different programming languages to convert an IP address from string representation (e.g. 192.168.10.1) into integer (0xC0A80A01 == 3232238081).

1.First determine the appropriate network adapter via the Device descriptor (descriptor->ParentInterface()).

2.Get the NodeMap of the network adapter.

3.The network adapter has a selector that can be used to select all connected cameras.

4.Iterate over all entries of the selector.

5.Check the IP address of the selector entry until you find the desired camera.

6.Open the camera.

7.Save the Device object.

genericC++

// 192.168.10.1
int64_t ipAddress = 0xC0A80A01;
std::shared_ptr<peak::core::Device> device = nullptr;
 
auto& deviceManager = peak::DeviceManager::Instance();
deviceManager.Update();
 
for (const auto& descriptor: deviceManager.Devices())
{
  auto nodemapParentInterface = descriptor->ParentInterface()->NodeMaps().at(0);
 
  // Get node to select the device
  auto nodeDeviceSelector = nodemapParentInterface->FindNode<peak::core::nodes::IntegerNode>("DeviceSelector");
 
  // Get node with the device IP address
  auto nodeDeviceIp = nodemapParentInterface->FindNode<peak::core::nodes::IntegerNode>("GevDeviceIPAddress");
 
  // Iterate through all selectors and find specified IP address
  for (int i = 0; i <= nodeDeviceSelector->Maximum(); i++)
  {
      nodeDeviceSelector->SetValue(i);
 
      // This is the correct camera
      if (nodeDeviceIp->Value() == ipAddress)
      {
          device = descriptor->OpenDevice(peak::core::DeviceAccessType::Control);
          break;
      }
  }
}
 
if (device)
{
  // ...
}

Alternatives and variations: Opening a camera with a specific name

You can use the UserDefinedName (DeviceUserID) to store a unique identifier for your camera in the camera memory, which you can use later to identify the camera. See Setting the camera name.

genericC++

std::string name = "camera1";
std::shared_ptr<peak::core::Device> device = nullptr;
 
auto& deviceManager = peak::DeviceManager::Instance();
deviceManager.Update();
 
for (const auto& descriptor: deviceManager.Devices())
{
  if (descriptor->UserDefinedName() == name)
  {
      device = descriptor->OpenDevice(peak::core::DeviceAccessType::Control);
      break;
  }
}
 
if (device)
{
  // ...
}

Alternatives and variations: Limiting the camera list to a specific transport layer

Normally, IDS peak searches for compatible transport layers in special folders in the installation path. The transport layers are registered in the environment variables GENICAM_GENTL32_PATH and GENICAM_GENTL64_PATH when IDS peak is installed. These default paths can be ignored. Instead, you can specify a concrete path to a transport layer. Afterwards, the DeviceManager will only list cameras that are supported and can be opened via this transport layer. To do this, you must call the DeviceManager's update command with a specific parameter.

genericC++

auto& deviceManager = peak::DeviceManager::Instance();
 
std::string pathToTransportLayer = "c:/Program Files/IDS/ids_peak/ids_u3vgentl/64/ids_u3vgentlk.cti";
deviceManager.AddProducerLibrary(pathToTransportLayer);
 
deviceManager.Update(peak::DeviceManager::UpdatePolicy::DontScanEnvironmentForProducerLibraries);

Complete code example

© 2024 IDS Imaging Development Systems GmbH