Specific Code - ADEEPT AWR Wheeled Robot Manual

4wd smart robot kit compatible with raspberry pi 4 3 model b+ b, opencv target tracking
Table of Contents

Advertisement

103

20.2 Specific Code

import
os
import
cv2
from
base_camera
import
import
numpy
as
np
import
time
import
threading
import
imutils
'''
Set the color of the line, 255 is the white line, 0 is the black line
'''
lineColorSet =
255
'''
Set the horizontal position of the reference, the larger the value, the lower, but not greater than the vertical resolution
of the video (default 480)
'''
linePos =
380
class
Camera(BaseCamera):
video_source = 0
def
__init__(self):
if
os.environ.get('OPENCV_CAMERA_SOURCE'):
Camera.set_video_source(int(os.environ['OPENCV_CAMERA_SOURCE']))
super(Camera, self).__init__()
@staticmethod
def
set_video_source(source):
Camera.video_source = source
@staticmethod
def
frames():
camera = cv2.VideoCapture(Camera.video_source)
if not
camera.isOpened():
raise
RuntimeError('Could not start camera.')
while True:
img = camera.read()
'''
BaseCamera
#Get the picture captured by the camera

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the AWR Adeept Wheeled Robot and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Picar-b

Table of Contents

Save PDF