Filling fake camera buffer with user image

Hi -

It isn’t clear to me how to use the arv_fake_camera_set_fill_pattern to supply a user defined image to the fake camera. It seems to me that the buffer in the callback comes from the camera once it is created. How would one go about reading image data and then filling that buffer - should that be done inside the callback? Is there a way to create an ArvBuffer outside the camera and tell it to use that?

Thank you!

Yes.

You can use the fill_pattern_data associated to the callback to pass any data you want. But you still have to copy this data to the buffer handled to the callback, as it will change at every call.

Thanks - I got this figured out now and can basically point a fake camera at a directory of images I captured and have it loop through them.

Hi @tenspd137,
I know its been a while, but I’ve run into the same issue. Can you share the code to accomplish this task?

I would also be interessted in that example.

Given this thread is basically coming alive again, I have found that I can load data into a buffer by using the (void *) cast to remove the const qualifier as mentioned in a previous thread here: Fake GV Camera - Setting next frame

But it is basically impossible to make a callback in any other way without breaking the const return of arv_buffer_get_data as the private structure for ArvBufferPrivate does not have its header available inarv.h. This means that the callback is a challenge to create, to a large degree. I’m not sure how this would even work in Python, unless swig is already handling this special case.

Even so, I can’t get the data to actually copy over using memcpy, so I wonder if there is more going on here. I can’t get data to copy in if using get_image_data or get_data, and without the ability to modify the buffer outside of aravis, or even the data structures available, I don’t see the point of having the callback, really.