개발/OpenCV + Data

openCV 6

----___<<<<< 2020. 5. 1. 13:27

TrackBar

import cv2
import numpy as np


def change_color(x):
    r = cv2.getTrackbarPos("R", "Image")
    g = cv2.getTrackbarPos("G", "Image")
    b = cv2.getTrackbarPos("B", "Image")
    image[:] = [b, g, r]
    cv2.imshow('Image', image)


image = np.zeros((600, 400, 3), np.uint8)
cv2.namedWindow("Image")

cv2.createTrackbar("R", "Image", 0, 255, change_color)
cv2.createTrackbar("G", "Image", 0, 255, change_color)
cv2.createTrackbar("B", "Image", 0, 255, change_color)

cv2.imshow('Image', image)
cv2.waitKey(0)

 

 

 

 

 

 

 

 

 

 

 

참조

https://github.com/ndb796/Python-Data-Analysis-and-Image-Processing-Tutorial/tree/master/11.%20OpenCV%20Tracker

'개발 > OpenCV + Data' 카테고리의 다른 글

openCV 8  (0) 2020.05.01
openCV 7  (0) 2020.05.01
OpenCV 5  (0) 2020.04.29
OpenCV 4  (0) 2020.04.29
OpenCV - 3  (0) 2020.04.29