opencv 키보드 이벤트


opencv 키보드 이벤트

import cv2 import numpy as np width, height = 500, 500 x, y, R = 256, 256, 50 direction = 0 while True: key = cv2.waitKeyEx(30) if key == 0x1B: # esc 16진수 break # 방향 전환 elif key == 0x270000: # 우 direction = 0 elif key == 0x280000: # 하 direction = 1 elif key == 0x250000: # 좌 direction = 2 elif key == 0x260000: # 상 direction = 3 # 방향 이동 if direction == 0: x+=10 elif direction == 1: y+=10 elif direction == 2: x-=10 elif direction == 3: y-=10 # 경계 확인 if x < R: x = R direction = 0 if x > width - R: x...



원문링크 : opencv 키보드 이벤트