fixed vision documentation

This commit is contained in:
Joel 2021-01-26 20:36:40 +01:00
parent dfb66d5383
commit c70edd4166
No known key found for this signature in database
GPG key ID: BDDDBECD0808290E

View file

@ -32,13 +32,14 @@ Using the Vision Module
import cv2
from compLib import Vision
# get newest opencv frame from camera
frame = Vision.Streaming.get_frame()
while True:
# get newest opencv frame from camera
frame = Vision.Streaming.get_frame()
# do some processing with the frame.....
# do some processing with the frame.....
# publish frame to streaming server
Vision.Streaming.publish_frame(frame)
# publish frame to streaming server
Vision.Streaming.publish_frame(frame)
Connect the raspberry pi to your internet and view the stream at: "http://your_raspi_ip:9898/". This should display
your raspberry pi camera. Note: the stream will lag a little bit BUT the processing of the image will be done in
@ -68,22 +69,23 @@ For testing you can point it at this image:
import cv2
from compLib import Vision
# get newest opencv frame from camera
frame = Vision.Streaming.get_frame()
while True:
# get newest opencv frame from camera
frame = Vision.Streaming.get_frame()
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
# convert image to grayscale image
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# convert image to grayscale image
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# find the chessboard corners
ret, corners = cv2.findChessboardCorners(gray, (6, 9), None)
# find the chessboard corners
ret, corners = cv2.findChessboardCorners(gray, (6, 9), None)
# draw detected chessboard position onto the image
cv2.drawChessboardCorners(frame, (6, 9), corners, ret)
# draw detected chessboard position onto the image
cv2.drawChessboardCorners(frame, (6, 9), corners, ret)
# publish frame to streaming server
Vision.Streaming.publish_frame(frame)
# publish frame to streaming server
Vision.Streaming.publish_frame(frame)
Connect the raspberry pi to your internet and view the stream at: "http://your_raspi_ip:9898/".