While following OpenCV tutorials, I noticed others have a display showing x and y coordinates like the screenshot below. Is this toolbar a feature of OpenCV? Is there a good way to implement a similar tooling that shows the current x, y and RGB of what has the mouse over?
Below is my current code snippet
import time
import cv2
def rescale_frame(frame, percent=75):
width = int(frame.shape[2] * percent/ 100)
height = int(frame.shape[0] * percent/ 100)
dim = (width, height)
return cv2.resize(frame, dim, interpolation =cv2.INTER_AREA)
vid = cv2.VideoCapture(0)
vid.set(cv2.CAP_PROP_FRAME_WIDTH, 160)
vid.set(cv2.CAP_PROP_FRAME_HEIGHT, 120)
vid.read()
time.sleep(1)
while True:
# capture the video frame by frame
ret, frame = vid.read()
# display the resulting frame
frame75 = rescale_frame(frame, percent=75)
cv2.imshow('frame75', frame75)
# cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
vid.release()
