Welcome to Jetson Orin NANO Developer Kit repository
18.Preview CSI camera image
Previewing the CSI Camera Feed
1. Implementation Principle
Use the CSICamera() function to capture frames from a CSI camera.
2. Implementation Effect
cd ~/opencv
xxxxxxxxxxpython3 18.camera_preview_csi.py # The program opens video0 by default; to open another camera, modify the device number yourself
Note: click the camera window and press q to exit.

3. Implementation Code
ximport cv2from jetcam.csi_camera import CSICameradef preview_usb_camera():cap = CSICamera(capture_device=0, width=640, height=480)while True:frame = cap.read()if frame is not None:cv2.imshow('CSI Camera Preview', cv2.resize(frame, (640, 480)))if cv2.waitKey(1) & 0xFF == ord('q'):breakelse:print("Error: Could not open CSI camera.")breakcap.release()cv2.destroyAllWindows()preview_usb_camera()