morefigs / pymba

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

How to force open a USB camera #131

Closed rk-exxec closed 4 years ago

rk-exxec commented 4 years ago

Hey, is there a way to force open a camera ( i.e. close all other connections). I am working on a program, and it crashes a lot. It leaves the vimba object and the camera in the open state which causes issues when I try to start my program again.

I tried self.cam.run_feature_command('DeviceReset') but this requires an open connection.

The crashes themselves seem to be caused by self.cam.disarm() during a continous acquisition. My callback looks like this:

def frame_handler(self, frame: Frame, delay: Optional[int] = 1) -> None:
    try:
        img = frame.buffer_data_numpy()
    except:
        pass
    self.change_pixmap_signal.emit(img)

If I omit the last line, my program doesn't crash anymore. So if someone has an idea about that, please let me know.

rk-exxec commented 4 years ago

closing because I accidentally posted a duplicate