Image can be shown well in GenICamBrowser, but cannot be shown through cvbpy

Hi everyone,

Now I try to use CVB to connect with a Gocator camera. The image captured by Gocator can be shown in GenICamBrowser very well. However, when I tried to show the image through a python script, the captured image is black, the maximum pixel value is 0.

    with cvb.DeviceFactory.open(cvb.install_path() + "/drivers/GenICam.vin") as vin_device:
        # asuming that the vin driver configures 3 buffers by default.
        #vin_device.stream.ring_buffer.change_count(5, cvb.DeviceUpdateMode.UpdateDeviceImage)
        # Get the device node map, which groups all settings for your camera (device)
        device_node_map = vin_device.node_maps["Device"]
        # access the camera feature
        stream = vin_device.stream
        # start the stream
        stream.start()
        # Wait for new image
        image, status = stream.wait_for(60000)
        print(cvb.as_array(image, copy=False).max())
        if status == cvb.WaitStatus.Ok:
            print("Buffer: " + str(image.buffer_index))
            array_image = cvb.as_array(image, copy=False)
            print(array_image.flags['OWNDATA'])
            np_array_3D = np.asarray(array_image)
            print("max value", np_array_3D.max())

Vendor: LMI
Model: Gocator 2340
Version: 6.1.32.12

Can anyone help me?

Thanks in advance.

Hi @zhouchuang0311

do all the other calls and outputs work correctly?
Do you see the same problem if you load the CVMock.vin?

Our Gocator expert @Simon will check this and come back at you here.

Maybe you could give the CVBViewer a try and tell us what happens when you load the driver there.

Cheers
Chris

Hi @zhouchuang0311,

did you try to get an image in the Common Vision Blox Viewer? In case you already receiva a black image here the issue is not CVBpy related.
Which settings did you use in the GenICam driver? Is the color format set to RAW?
Can you verify that commands are received at the Gocator (cheking over the Webinterface)?
Can you verify the the Gocator is grabbing and CVB is receiving (frame count) and only the received images/datapackages contain 0 valued pixel?

Best regards,
Simon

1 Like

Thanks for your help. After I change the color format from auto to RAW, the depth camera works.

However, now I have met another question. In our camera system, we have two cameras, one is an RGB camera, the other is Gocator. I want to get the streams from them together, and their trigger method is the same. However, if I run two separate python scripts, like rgb.py and depth.py,

# rgb.py
with open("...GenICam.vin", port=0) as vin_device:
    # related codes to get the stream
# depth.py
with open("...GenICam.vin", port=1) as vin_device:
    # related codes to get the depth stream

I can get the RGB and depth images.

However, if I use threads to get the images, the depth camera can not capture the image, the code is like:

# main.py
Thread(function rgb)
Thread(function depth)
# function rgb
with open("...GenICam.vin", port=0) as vin_device:
    # related codes to get the stream
# function depth
with open("...GenICam.vin", port=1) as vin_device:
    # related codes to get the depth stream

In summary, if I run two python scripts separately, everything is perfect. If I want to integrate them in multi threads and run the code in one script, one of the cameras cannot receive images. Should I use StreamingParallel or StreamingAsync to get the streams?

Thanks.

Hi @zhouchuang0311 ,

this might be due python not being very neat when it comes to multithreading.
I suggest you to have a closer look at the following examples in your cvb installation folder/tutorials/image manager:
StreamingParallel
StreamingSimple

Cheers
Chris

Hi Chris,

Thanks for your reply. When I tried to run the code StreamingSimple, there is an error "module ‘cvb’ has no attribute ‘AcquisitionsStack’.`
The version of cvb manager console is: 13.04
cvbpy is: 1.1

Thanks.

Sorry streaming simple was wrong anyway… streaming parallel or streaming async should adress your task.

I will still have a look into that error.

Edit: Works for me on Win 10 x64 with CVB 13.4

Hi,

Thanks for your information, now my system works.

Btw, in my case, () in device.stream() should be deleted, otherwise, an error like “stream is not callable” will arise.
:slight_smile:

Good point, that changed with the latest CVBPy wrappers.

Glad to hear, that you got your system running.

Hi Chris,

Sorry to bother you again. Now I meet a new problem.

In our project, we use a color camera (Teledyne DALSA Linea C2048-7um) and two depth cameras (Gocator 2340, configured in master slave configuration). Due to previous decisions, the color and 3D cameras have been put in different subnets (192.168.2.X and 192.168.3.X respectively).

A change in PC now limits us to just one build-in ethernet port (Intel I225-V), which we have configured to handle VLANs (eight in total). The trunk coming from the PC is then split by a managed switch (Ubiquiti EdgeSwitch 8) to connect to all separate networks. This setup allows us to use only one ethernet port on the PC while separating all devices from each other.

The weird thing is: If the color camera is connected with the computer via the switch (over VLAN 4033), it cannot be detected by the GenIcamBrowser. However, if we ping the IP address of the line camera (192.168.2.20), we do get a reply from the line camera. Moreover, when the depth camera (master 192.168.3.11 & slave 192.168.3.12) are connected to the computer via the switch (over VLAN 4034), they can be detected by the GenIcamBrowser.

The IP addresses of the virtual ports on the PC are set to 192.168.2.253 and 192.168.3.253 for VLAN 4033 and 4034 respectively.

Thanks in advance!

@usernv do you have some input on this?
I would have assumed windows to not be able to handle multiple virtual ports on 1 physical port correctly, but as the camera can be pinged I cant help but think that CVB somehow has a problem here.

@zhouchuang0311 meanwhile you could try to go with the discover interface:
https://forum.commonvisionblox.com/t/api-device-discovery-with-allow-broadcast-acknowledge-ignore-subnet/1260
And try if this gives you more devices (very unlikely though but still worth a try)

Thanks for your suggestions. Unfortunately, the code in the link can’t work. Perhaps we should find other methods to solve this problem.

I think you’ll need to add both IPs to the NIC to access them. The ping might have a different subnet mask and might find the device. Can you try adding the other IP as well?

Hi,

Using Intel PROSet Adapter Configuration Utility, one can virtually split up one Intel NIC, providing the NIC supports it.

Each virtual NIC is then individually shown in Control Panel\Network and Internet\Network Connections.

Each virtual NIC and the dongle interface are subsequently assigned a unique IP address within the network.

Leaving the PC configuration unchanged, several network constructions were tested;

  1. The setup we’d like to get working, using the managed switch to trunk the different VLANs over one cable to the PC’s NIC. The untagged VLANs are 4033 and 4034 in respectively port 5 and 6.

  2. The setup we’re forced to use right now. All but the 1D networks are trunked to the PC by the switch. For the 1D camera, a USB dongle is used.

  3. The setup we used to check whether the switch is set up correctly to support all communication protocols needed. This 3rd setup mixes the 1st and 2nd. All the VLANs are trunked from one switch to the other. Where VLAN 4033 is untagged on port 7. VLAN 1 is untagged on port 8, accompanied by all the other VLANs (apart from 4033) as tagged networks. Switch port 7 is connected to the USB dongle and switch port 8 to the native Intel NIC.

Setup 2 and 3 work perfectly, but when using setup 1 GenICamBrowser isn’t discovering the color camera. Leading to the conclusion that there are no issues caused by the switch configuration.

As a reply to your last message; we assigned each virtual adapter its own unique IP, corresponding to the subnet used within that VLAN.

Hi @zhouchuang0311

this is something we would have to have a more detailed look at and maybe even try to reproduce here in our office.
So if you would be so kind to contact your local sales or support contact here at Stemmer.

Cheers