Closed Lemon2911 closed 2 months ago
Hello, would it be possible to share a code sample that does not seem to work for you? As long as the PVCAM is initialized and camera is opened, the "frame = cam.get_frame(exp_time=20)" call should work.
hello,
After further my attempts, this seems to be a compatibility issue with PyQT (labscript uses it as a GUI framework).
When I try to call the camera in a minimal PyQt demo, the program quits unexpectedly with the error message: Process has ended, exit code is -1073741819 (0xC0000005)
Here's the code I used for testing:
import numpy as np
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from matplotlib import pyplot as plt
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
global pvc, Camera
from pyvcam import pvc
from pyvcam.camera import Camera
pvc.init_pvcam()
try:
self.cam = next(Camera.detect_camera())
self.cam.open()
if self.cam.is_open:
print("Camera opened")
except StopIteration:
print("No camera detected")
# Set window properties
self.setWindowTitle("My Window")
self.setGeometry(100, 100, 600, 400)
# Create a button
self.button = QPushButton("Click me", self)
self.button.move(260, 180)
# Connect the button to the function
self.button.clicked.connect(self.button_clicked)
def snap(self):
"""Get an image."""
try:
print("snapping image")
frame = self.cam.get_frame(exp_time=2).reshape(self.cam.sensor_size[::-1])
plt.imshow(frame, cmap="gray")
plt.show()
print("image snapped")
except:
print("failed to snap image")
def button_clicked(self):
self.snap()
if __name__ == "__main__":
app = QApplication([])
window = MainWindow()
window.show()
app.exec_()
Hello, I have just tested the code that you have provided and it seems to be working fine for me. What Visual Studio version and Python version are you using?
Hello,I used Python 3.11.7 and MS Build Tools 17.10.1
Unfortunately, We are still unable to reproduce the issue. But the symptoms look similar to issue #47.
Could you please try the same fix as described in this https://github.com/Photometrics/PyVCAM/issues/47#issuecomment-2179016079 ?
Hello,I solved the problem by reinstalling the system and then installing MS Build Tools 2022 17.2.1, thank you for your help
Hello,
I'm trying to integrate the Kintex camera into the Labscript (an open source experiment control and automation system).I successfully initialized the camera and can return the working status of the camera via getter.
However, when I tried to call the get_frame function to capture a single frame, I found that the function did not return properly and it seemed to be stuck somewhere
But I've found that running single_image_polling_show.py works fine.So I'm confused and want help
Thank you very much