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.
Anybody has an idea?
Thanks a lot.
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 matplotlib.pyplot as plt
# choose driver
device = cvb.DeviceFactory.open(os.environ["CVB"] + "/drivers/GenICam.vin");
# start streaming
stream = device.stream;
# 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))
# stop streaming
As a result I get my rangemap displayed (Mono 16Bit).
thank you for your great answer
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”.
Variable matrix is also correct (uint16) in my case.
What is the bit depth of your image when you save it (as TIFF) in the CVB ImageViewer for instance?
Do you use 32 or 64Bit CVB?
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!).
I have no clue what is the problem here.
I get correct values for the variable matrix (uint16), too.
What is the bit depth you receive when you store the image (as TIFF) with the CVB image viewer?
Do you use 64 or 32Bit CVB?
When I check the image in the CVB Image Viewer it is an 8 bit image.
I think I am using the 64bit CVB.
Do you think you could show me which nodes you set for you example?
Thanks a lot
I use CVB 64Bit, too.
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:
…\STEMMER IMAGING\Common Vision Blox\Lib\Python\cvb
cvb.zip (325.6 KB)
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.
that made the trick
Change it to raw was right .
Thanks a lot