def nothing(x):
print(x)
img = np.zeros((300,500,3),np.uint8)
cv2.namedWindow('image')
cv2.createTrackbar('Red','image',0,255,nothing)
cv2.createTrackbar('Green','image',0,255,nothing)
cv2.createTrackbar('Blue','image',0,255,nothing)
while 1:
cv2.imshow('image',img)
key = cv2.waitKey(1)
if key == 27:
break
r = cv2.getTrackbarPos('Red','image')
g = cv2.getTrackbarPos('Green','image')
b = cv2.getTrackbarPos('Blue','image')
img[:] = [b,g,r]
cv2.destroyAllWindows()
python opencv轨迹栏
最新推荐文章于 2024-01-06 15:12:00 发布