Aravis - Python playback fake data

Hi all!
I am trying to playback a set of images(numpy.ndarray) using the Aravis fake camera interface in python and I am having trouble getting back the correct images during the camera acquisition. My images are 100 by 100 pixels with each pixel being of type numpy.uint16.

When I create the Aravis.Buffer I used Aravis.Buffer.new(size, preallocated )
I pass the number of bytes in my images for the size parameter = 20000
But I am not exactly sure what it expects for the second argument. I tried to convert the images to byte arrays and then cast those into ctype objects and then pass the adderss of the pointer to this ctype object then pushed the buffer into the stream. Once the camera starts acquiring, I pop the stream and try to retreive the images back from the buffer. But I am getting garabage data from the buffer and not the original images. Could someone point out what the correct argument type for preallocated is?

“garbage” data or something that looks more like the fake camera?

not “garbage” data, but rather proper images.

As far as I know, you’re just allocating where the data should go – not actually updating the data the stream generates. For that you would need to update the acquisition function itself. If you make a buffer with preallocated data and then immediately do a get_data, it probably would have your data.

You are absolutely right. Realized it late that the preallocated buffer holding the images was being overwritten from the stream.

Great! Good to hear it is resolved. I’ve been fighting how to create a better fake camera function – I need to write up something on that :\