Created
July 10, 2023 18:12
-
-
Save smith0022/d01e99c403a6936403b50456d54a5d89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 as cv2 | |
import numpy as np | |
import math as m | |
from picamera2 import Picamera2 | |
cap = Picamera2() | |
cap.configure(cap.create_preview_configuration(main={"format": 'XRGB8888', "size": (640, 480)})) | |
cap.start() | |
while True: | |
img = cap.capture_array() | |
detect=cv2.QRCodeDetector() | |
value, points,cde = detect.detectAndDecode(img) | |
if value == "grab the bottle": | |
distan = 4.8*650/(points[0][2][1]- points[0][1][1]) | |
print(str(distan)) | |
key = cv2.waitKey(1) | |
if key == 83 or key == 113: | |
break | |
# import the necessary packages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment