My attempts to “create your camera and set it to running” in the DLI lesson of “Interactive Classification Tool” regularly returns the error of “NameError: name ‘camera’ is not defined”. The Raspberry Pi Camera Module V2 purchased from “sparkfun” worked as intended in the prior Hello Camera lesson. Firefox did not work so am using Chrome. I am a complete novice at Python and suspect that part of the dilemma may be that I may have not yet found a correct way to “Uncomment the appropriate camera selection lines…”. I “Shutdown Kernel” between each attempt and have restarted JupyterLab multiple times.
Assistance would be greatly appreciated.
The related “full reset of the camera” and “Traceback” and information is copied below.
Full reset of the camera
!echo ‘dlinano’ | sudo -S systemctl restart nvargus-daemon && printf ‘\n’
Check device number
!ls -ltrh /dev/video*
USB Camera (Logitech C270 webcam)
from jetcam.usb_camera import USBCamera
camera = USBCamera(width=224, height=224, capture_device=0) # confirm the capture_device number
CSI Camera (Raspberry Pi Camera Module V2)
from jetcam.csi_camera import CSICamera
camera = CSICamera(width=224, height=224)
camera.running = True
[sudo] password for dlinano:
crw-rw----+ 1 root video 81, 0 Jun 14 21:48 /dev/video0
NameError Traceback (most recent call last)
12 # camera = CSICamera(width=224, height=224)
—> 14 camera.running = True
15 print(“camera created”)