실시간 영상 대신 촬영한 영상 불러오는 코드. 가로세로줄 뜸
import cv2 import numpy as np cap = cv2.VideoCapture("Rack.mp4") while True: ret, frame = cap.read() if ret is False: break roi = frame[100: 795, 537: 1416] rows, cols, _ = roi.shape gray_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY) gray_roi = cv2.GaussianBlur(gray_roi, (7, 7), 0) _, threshold = cv2.threshold(gray_roi, 5, 255, cv2.THRESH_BINARY_INV) _, contours, _ = cv2.findContours(threshold, cv..
2021. 1. 19.
Eye motion tracking – Opencv 3 with Python 라즈베리파이
라즈베리파이4에 OpenCV 3.4.3 설치 후 python3으로 라즈베리파이4에서 실행 했을 때 잘 됨. import cv2 import numpy as np cap = cv2.VideoCapture(0) while True: ret, frame = cap.read() roi = frame[269: 795, 537: 1416] rows, cols, _ = roi.shape gray_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY) gray_roi = cv2.GaussianBlur(gray_roi, (7,7), 0) _, threshold = cv2.threshold(gray_roi, 5, 255, cv2.THRESH_BINARY_INV) _, contours, _ = cv2..
2021. 1. 16.