opencv, this is basically the code for the pencil tracking ```python rgb_color = np.uint8([[[6, 45, 122]]]) hsv_color = cv2.cvtColor(rgb_color, cv2.COLOR_RGB2HSV) h, s, v = hsv_color[00] lower_color = np.array([h-10, 100, 100]) # lower bound of the blue color in HSV upper_color = np.array([h+10, 255, 255]) # upper bound of the blue color in HSV kernel = np.ones((5, 5), np.uint8) ... def foo(...): ret, frame = self.cap.read() #actual camera footage if not ret: return "Nothing" #rotating and converting to a hsv colour map frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE) hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) #create a mask of the colour i want within a range and clean it up a bit mask = cv2.inRange(hsv_frame, lower_color, upper_color) mask = cv2.erode(mask, kernel, iterations=1) mask = cv2.dilate(mask, kernel, iterations=1) contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) #if there are any blue stuff on screen if contours: largest_contour = max(contours, key=cv2.contourArea) #find the largest blue area ((x, y), radius) = cv2.minEnclosingCircle(largest_contour) #find is coordinates and rough radius if radius > 5: cv2.circle(frame, (int(x), int(y)), int(radius), (0, 255, 0), 2) ```
Make it a GitHub repo, I would to help with some quality of life touches :3