#!/usr/bin/python
#coding:utf-8
import cv2
import numpy as np
def cb():
pass
if __name__ == "__main__":
img = cv2.imread("test.jpg")
assert img is not None, "test.jpg can not be opened!"
img = cv2.cvtColor(img, cv2.COLOR_BGR2YUV)
dst = np.array(img.shape, np.uint8)
cv2.namedWindow('image')
cv2.createTrackbar('U', 'image', 10, 20, cb)
cv2.createTrackbar('V', 'image', 10, 20, cb)
kernel = np.array([[0.299, 0.587, 0.114],
[-0.1678, -0.3313, 0.5],
[0.5, -0.4187, -0.0813]])
while(1):
cv2.imshow('image', dst)
k=cv2.waitKey(1)&0xFFFF
if k == 27:
break
u = cv2.getTrackbarPos('U', 'image')
v = cv2.getTrackbarPos('V', 'image')
print u,v
#tmp = (img -[0, 127, 127])* [ 1
基于YUV图像的色彩调节
最新推荐文章于 2024-05-26 11:43:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)