Dynamic change of ROI

Hi, I am trying to implement a dynamic change of the region. i.e. changing region the camera captures during acquisition.

I have found that it is possible to change the region if I stop the acquisition and restart it again afterwards. The capturing of the images works and images are correct, also all the metadata seems correct.

The only problem is that ArvBuffer starts to report: ARV_BUFFER_STATUS_TIMEOUT. I found that this happens any time the allocated buffer size is bigger than the actual size of the image. - To me, it seems a bit curious as all the statistics of the image are known to Aravis so don’t see a reason why it should report an error when a buffer is larger than needed - maybe a bug???

Nevertheless, I tried to find a way to destroy a whole stream and create a new one with the correct buffer size in order to prevent the timeout error, but I did not find a way how to do that? Is there a function to call or it is enough to just let the stream go out of the scope?

So my question is what should I do next? Is the error a bug which I can fix and create a pull request. Is there a proper way how to release stream which I am missing? Or is there some other way I am missing?

Anyway I woudl like to thank you for help and for the great library


That is because aravis uses the buffer size as the number of bytes it waits for. There is no indication in the image leader of the expected payload. May be we could make aravis accept larger buffer than expected and tell the receiving thread what is the payload size, but that is not implemented yet.

Anyway, it is possible to change dynamically the ROI size, at the expense of deleting all the buffers in the queues and start/stopping the receiving thread. There is an example here:


1 Like

Hi Emanuel, thanks for really quick response, looks great. I will try the approach you’ve shown me for now. If I will have some spare time i will try to look into the source to see if there would be some possibility of adding this feature in some sensible way.

Regards and thanks again