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

**URL:** https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541
**Category:** Programming Questions
**Tags:** display, acquisition, genicam
**Created:** [November 5, 2021, 4:51pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541 "2021-11-05T16:51:21Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![zhouchuang0311](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zhouchuang0311](https://forum.commonvisionblox.com/u/zhouchuang0311)
#### Post date: [November 5, 2021, 4:51pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/1 "2021-11-05T16:51:21Z")

</div>

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.

```auto
    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.

---

<div class="post-metadata">

### Author: ![Chris](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/chris/32/1154_2.png) [@Chris](https://forum.commonvisionblox.com/u/Chris)
#### Post date: [November 8, 2021, 3:04pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/2 "2021-11-08T15:04:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Simon](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/simon/32/847_2.png) [@Simon](https://forum.commonvisionblox.com/u/Simon)
#### Post date: [November 8, 2021, 3:13pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/3 "2021-11-08T15:13:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zhouchuang0311](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zhouchuang0311](https://forum.commonvisionblox.com/u/zhouchuang0311)
#### Post date: [November 10, 2021, 8:55am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/5 "2021-11-10T08:55:12Z")

</div>

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,

```auto
# 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:

```auto
# 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.

---

<div class="post-metadata">

### Author: ![Chris](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/chris/32/1154_2.png) [@Chris](https://forum.commonvisionblox.com/u/Chris)
#### Post date: [November 10, 2021, 9:22am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/6 "2021-11-10T09:22:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zhouchuang0311](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zhouchuang0311](https://forum.commonvisionblox.com/u/zhouchuang0311)
#### Post date: [November 10, 2021, 9:39am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/7 "2021-11-10T09:39:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Chris](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/chris/32/1154_2.png) [@Chris](https://forum.commonvisionblox.com/u/Chris)
#### Post date: [November 10, 2021, 9:43am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/8 "2021-11-10T09:43:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zhouchuang0311](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zhouchuang0311](https://forum.commonvisionblox.com/u/zhouchuang0311)
#### Post date: [November 10, 2021, 1:53pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/9 "2021-11-10T13:53:36Z")

</div>

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.  
🙂

---

<div class="post-metadata">

### Author: ![Chris](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/chris/32/1154_2.png) [@Chris](https://forum.commonvisionblox.com/u/Chris)
#### Post date: [November 10, 2021, 1:55pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/10 "2021-11-10T13:55:43Z")

</div>

Good point, that changed with the latest CVBPy wrappers.

Glad to hear, that you got your system running.

---

<div class="post-metadata">

### Author: ![zhouchuang0311](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zhouchuang0311](https://forum.commonvisionblox.com/u/zhouchuang0311)
#### Post date: [November 16, 2021, 9:02am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/11 "2021-11-16T09:02:34Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Chris](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/chris/32/1154_2.png) [@Chris](https://forum.commonvisionblox.com/u/Chris)
#### Post date: [November 16, 2021, 1:52pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/12 "2021-11-16T13:52:33Z")

</div>

@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](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)

---

<div class="post-metadata">

### Author: ![zhouchuang0311](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zhouchuang0311](https://forum.commonvisionblox.com/u/zhouchuang0311)
#### Post date: [November 17, 2021, 9:44am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/13 "2021-11-17T09:44:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![usernv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/usernv/32/637_2.png) [@usernv](https://forum.commonvisionblox.com/u/usernv)
#### Post date: [November 17, 2021, 10:33am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/14 "2021-11-17T10:33:48Z")

</div>

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?

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/c18271d0476698dfb24d04f381c86c0b4b0f9017.png)

---

<div class="post-metadata">

### Author: ![zhouchuang0311](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zhouchuang0311](https://forum.commonvisionblox.com/u/zhouchuang0311)
#### Post date: [November 19, 2021, 1:30pm UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/15 "2021-11-19T13:30:44Z")

</div>

Hi,

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

 ![a_01_Intel PROSet Adapter Cnfiguration Utility](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/eae3f7e7df97e7db8ad09257e7d7ef6ffa6f1966.png)

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

 ![a_02_Network Connections](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/d3358d5d4cc94124bcd49e81fc1c0f0082852302.png)

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

 ![a_03_IP addresses](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/a95f12948f3e06fea106a3d4370f3dd3c18bb070.png)

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.

---

<div class="post-metadata">

### Author: ![Chris](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/chris/32/1154_2.png) [@Chris](https://forum.commonvisionblox.com/u/Chris)
#### Post date: [November 22, 2021, 7:19am UTC](https://forum.commonvisionblox.com/t/image-can-be-shown-well-in-genicambrowser-but-cannot-be-shown-through-cvbpy/1541/16 "2021-11-22T07:19:19Z")

</div>

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
