I am using a c2 camera from Automation Technology. I use Python and CVB.py to access the camera. Everything workes fine. I can get an Image etc.
But I can’t figure out how I can read the data from the output channel DC2. In the manual it sais that the output channel returns the position of center of gravity.
yes, you’re right. DC2 contains the range values of the current image. The output channels of AT cameras can be configured by the user in the camera nodemap. There can be either one output enabled or multiple.
In case only DC2 is enabled, the image buffer contains only the rangemap information. In case of multiple data channels enabled, the information is transmitted interleaved to the PC. Thus it is necessary to separate the different line information.
In the following I show you a basic example where I acquire an image from an AT camera and display the image as it is:
CVB Color Format: Raw (0)
Data Channels: only DC2 enabled
import numpy
import cvb
import os
import matplotlib.pyplot as plt
# choose driver
device = cvb.DeviceFactory.open(os.environ["CVB"] + "/drivers/GenICam.vin");
# start streaming
stream = device.stream;
stream.start()
# acquire number of images
for i in range(1):
image, status = stream.wait()
if status == cvb.WaitStatus.Ok:
# create numpy array from cvb image (without copying data)
matrix = cvb.as_array(image)
# do something with image
print("Acquired image: " + str(i))
plt.imshow(matrix.transpose(), cmap="gray")
else:
pass
# stop streaming
stream.stop()
As a result I get my rangemap displayed (Mono 16Bit).
But are you sure you get a 16 bit rangemap? When I use the Funktion cvb.as_array() it returns an 8 bit rangemap, even though I set the Pixelformat of the c2 to “Mono16”.
When I save the image it is a 32 bit Image. But when I just print the matrix in python it sais that ist is uint8.
I have also a problem with my value range. When using “Mono16” my values are between 1 and 3 (integer!).
The only thing that you need to set is the following:
Set CVB color format in the GenICam.ini file to either Raw(0) or Mono16(3)
Camera Parameters
Camera Mode: Any 3D Mode (e.g. 3D Center of Gravity)
Data Output Channels: at least DC2 enabled (e.g. only DC2)
Pixel Format: Mono16
I use CVB 13.00.005 and the current version of the Python wrappers (Bindings Preview 13.00.267). It might be possible that you run your program with an older version. Please find attached the wrappers I use. You can just copy them to the CVB directory:
thank you for your advice. I also set the same nodes.
But where do I find the GenICam.ini or do you mean GenICam.vin? And how do you change it from Raw to Mono?
You can find the location of the GenICam.ini file by typing the environmental variable %cvbdata% into your explorer. It is located in the Drivers folder. It is used by the GenICam.vin driver which you load in Python.
For your interest… you can configure the GenICam.ini file also by using the GenICam Browser (see image below). In fact, this would be the standard way.