Skip to content

Example code for python cameraserver does not work and contains mistakes #2754

Open
@DanPeled

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 doing cs.getVideo()), should be CameraServer.getVideo() probably
  • input_img is passed to grabFrame before being declared
  • cvSink does not exist (probably should be sink)

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions