Example code for python cameraserver does not work and contains mistakes #2754
Open
Description
the example code provided :
from cscore import CameraServer
import cv2
import numpy as np
CameraServer.enableLogging()
camera = CameraServer.startAutomaticCapture()
camera.setResolution(width, height)
sink = cs.getVideo()
while True:
time, input_img = cvSink.grabFrame(input_img)
if time == 0: # There is an error
continue
does not work for several reasons:
cs
does not exist (referenced when doingcs.getVideo()
), should beCameraServer.getVideo()
probablyinput_img
is passed tograbFrame
before being declaredcvSink
does not exist (probably should besink
)