Acquire exposure serie, Distorsions in image


I have some problems when taking a exposure serie of images.

It allmost always result in some distortion in the image. I dont know if its a camera problem or a poorly managed acquisition?

The camera i use is a JAI GO-5000C-PGE.

And here is my code:

import os
import cv2
import numpy as np
import cvb
import time

###my functions
from PS_image_data_tools import combo_im_show, save_images

####Camera setup
path = "%CVB%/Drivers/"  # Sökväg till vin filen
path_exp = os.path.expandvars(path)

camera =
stream =

###Acquire exposure serie
exposure_series_images = []
device_node_map = camera.node_maps["Device"]
exposure = device_node_map["ExposureTime"]
acquisition_Rate = device_node_map['AcquisitionFrameRateRaw']

for expos in np.linspace(5000, 200000, 9):
    expos_value = int(expos)

    acquisition_Rate.value = max(expos_value + 50000, 100000)
    exposure.value = expos_value

    img, status = stream.get_snapshot()
    if status == cvb.WaitStatus.Ok:
        img_array = cvb.as_array(img, copy=False)
        img_array = img_array[:, :, [1, 0, 2]].astype(np.uint16)

        raise RuntimeError("timeout during wait"
                           if status == cvb.WaitStatus.Timeout else
                           "acquisition aborted")

###reset the exposure value
acquisition_Rate.value = 500000
exposure.value = 200000

###make image subplot, Return the subimage
IMG = combo_im_show('expo', exposure_series_images, ret=True)

###Save image
save_images(img=IMG.astype(float), name='combo_ecpo.tif')


Here is a example

Is my camera broken or is there a way to reduce/eliminate this?
I rarely get this when taking a image using CVB device manager, but it has happened.

Looks a bit like packet loss to me. Have you configured the NIC like instructed here:

(section GigE Vision > Network Configuration)

Especially settings in regard to the buffer sizes and jumbo frames. The camera should also have the right settings for the packet size and so on.

Could you check these settings?

1 Like

Jai go 5000 eh? Check the interpacket delay setting on the camera for that one. That’s almost certainly it. Send an email to support@stemmer-imaging.(pickyourcountry) to get help with that.

It’s indeed package loss, and with the JAI go camera you have to set the interpacket delay carefully, otherwise you get black lines like you see in your image.

The jai control tool has an inbuilt calculator for that.

1 Like

Tanks for response!

I went through the network configurations, I enabeld jumbo pakages and increased number of buffer.

I also added a packet delay (on feeling), I will lock in to the JAI tool for calculating this.

Now it works!

Excellent suport, Thanks!

1 Like

@Beccau alright, this sounds good! Could you please mark one of the replies here as the solving answer?

I tried to reset the packet delay and it still works so it was the jumbo packet and the buffer that made the difference.

I have encountered another problem, When i take several exposure series in a row, with code similar to the first post, i sometimes get one (sometimes two) images with higher intensity in the beginning of the serie.

i have calculated the mean pixel value of the images and look at the timestamp in order to rule out that it is some memory error in my code. it seems like it is a unique image, but with to long exposure time

Any idea of what can cause this?

image =                     10
exposure value micro sec =  200000.0
time since last image =     27463951.0
mean intensity =            169.81691773732504
image =                     11
exposure value micro sec =  5000.0
time since last image =     21868552.0
mean intensity =            152.64980894724528
image =                     12
exposure value micro sec =  53750.0
time since last image =     19120265.0
mean intensity =            125.13789710998535

It seems that your last question has been overlooked. Maybe because one answer was set as solution.

If you still need assistance regarding this issue please contact
as this only related to the camera.

How did u get the jai camera to work with opencv? I know this is an old forum but any help would be appreciated as i have been scouring the internet for days trying to find any indication that this is possible.

Hi @Embeddediot ,

as far as I am aware, there is no open cv involved here. This is just plain CVB functionality.
However in the Python wrappers of CVB you have a neat little function “cvb.as_array(CvbImage)” that returns you a numpy array containing the image data.
With this you should also be able to pipe your imagedata that you acquired with Cvb into OpenCv:

import os 
import cvb  

image = cvb.Image(os.path.join(cvb.install_path(), "tutorial", "Clara.bmp")) 
m = cvb.as_array(image, copy=False) 

for y in range(len(m)): 
    for x in range(len(m[0])): 
        new_value = m[y, x] + 20 
        if new_value > 255: 
            new_value= 255 
        m[y, x] = new_value"D:/claraTest.bmp") 

I know I might be late to the party, but if you are looking for ways to get images from your Jai camera into OpenCV, we usually recommend to take care of the acquisition through the CVB API and then pass over the CVB image to OpenCV. OpenCV has no GenICam interface and won’t interface out of the box to GEV or U3V cameras that expect to be addressed through that protocol.

A description of how to transfer the image vom CVB to OpenCV efficiently is mentioned in (search for CVBInterop).