I tried to run this camera stucks when it is to pass frame for processing in virtual environment. If i execute same program outside Venv then it runs properly. Even i tried reinstalling again still this issue is there. I also tried to run this code It runs outside of venv but inside it stucks at frame=camera.capture_array(). Help me.
Thanks in advance!!
Code:
from picamera2 import Picamera2import cv2# Initialize the PiCamera2camera = Picamera2()# Configure the camera for previewpreview_config = camera.create_preview_configuration()camera.configure(preview_config)# Start the cameracamera.start()try: while True: # Capture the current frame frame = camera.capture_array() # Display the frame in an OpenCV window #cv2.imshow("Camera Preview", frame) print("done") break # Exit the preview if 'q' is pressed if cv2.waitKey(1) & 0xFF == ord('q'): breakfinally: # Stop the camera and close OpenCV windows camera.stop() cv2.destroyAllWindows()
Thanks in advance!!
Statistics: Posted by chopdeankur — Fri Jan 03, 2025 7:22 pm