morefigs / pymba

Python wrapper for Allied Vision's Vimba C API
MIT License
105 stars 84 forks source link

Streaming with 'Continuous' mode disconnect camera in few seconds #130

Open oao112358 opened 4 years ago

oao112358 commented 4 years ago

Hi, I'm trying to to use pymba with Manta G-419C(Gige).

For instance, when I do opencv_acquire_streaming_images.py in examples, and I use Vimba Viewer to confirm that camera is locked by python or not. I can get images in first few seconds(about 2 or 3 seconds), and the camera is actually locked by python. But after that, I fount that the camera is unlocked by Vimba Viewer, and my python cannot get other image anymore.

Then I will get Operation is invalid with the current access mode on camera.stop_frame_acquisition() or camera.disarm(). If I comment out these codes, python will close without any exception or error. So I guess that Operation is invalid with the current access mode is caused by python didn't get camera's control.

However, I can get streaming by Vimba Viewer and Matlab uninterrupted without any error. I really tried to search a solution on internet or other issue but I can't find any similar problem.

Thank you for your help!

rk-exxec commented 4 years ago

VimbaViewer will take control of the camera if you press play/stop once. You have to close vimba viewer and reopen the cam in python. If you look at the official VimbaPython, it basically forces you to reopen the API and camera connection every time you want to send a command. I guess thats whats happening with MATLAB, too. It forcibly takes control of the cam.

I had this issue and solved it by calling the AcquisitionStop command feature directly.