# Aravis - Python playback fake data

**URL:** <https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765>\
**Category:** Uncategorized\
**Created:** [June 4, 2024, 10:23pm UTC](https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765 "2024-06-04T22:23:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex\_neva](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@alex\_neva](https://aravis-project.discourse.group/u/alex_neva)\
**Post date:** [June 4, 2024, 10:23pm UTC](https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765/1 "2024-06-04T22:23:18Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![joshec](https://yyz2.discourse-cdn.com/free1/user_avatar/aravis-project.discourse.group/joshec/32/298_2.png) [@joshec](https://aravis-project.discourse.group/u/joshec)\
**Post date:** [June 11, 2024, 9:53pm UTC](https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765/2 "2024-06-11T21:53:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alex\_neva](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@alex\_neva](https://aravis-project.discourse.group/u/alex_neva)\
**Post date:** [June 12, 2024, 8:56am UTC](https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765/3 "2024-06-12T08:56:06Z")

</div>

not “garbage” data, but rather proper images.

---

<div class="post-metadata">

**Author:** ![joshec](https://yyz2.discourse-cdn.com/free1/user_avatar/aravis-project.discourse.group/joshec/32/298_2.png) [@joshec](https://aravis-project.discourse.group/u/joshec)\
**Post date:** [June 12, 2024, 3:40pm UTC](https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765/4 "2024-06-12T15:40:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alex\_neva](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@alex\_neva](https://aravis-project.discourse.group/u/alex_neva)\
**Post date:** [June 13, 2024, 10:39am UTC](https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765/5 "2024-06-13T10:39:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joshec](https://yyz2.discourse-cdn.com/free1/user_avatar/aravis-project.discourse.group/joshec/32/298_2.png) [@joshec](https://aravis-project.discourse.group/u/joshec)\
**Post date:** [June 13, 2024, 1:24pm UTC](https://aravis-project.discourse.group/t/aravis-python-playback-fake-data/765/6 "2024-06-13T13:24:23Z")

</div>

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 :\
