import cv2
img_path = 'C:/Users/WZChan/Desktop/'
img = cv2.imread(img_path + 'tree.jpg')
img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
turn_green_hsv = img_hsv.copy()
turn_green_hsv[:, :, 0] = (turn_green_hsv[:, :, 0] + 15) % 180
turn_green_img = cv2.cvtColor(turn_green_hsv, cv2.COLOR_HSV2BGR)
cv2.imwrite(img_path + 'turn_green.jpg', turn_green_img)
colorless_hsv = img_hsv.copy()
colorless_hsv[:, :, 2] = 0.5 * colorless_hsv[:, :, 1]
colorless_img = cv2.cvtColor(colorless_hsv, cv2.COLOR_HSV2BGR)
cv2.imwrite(img_path + 'colorless.jpg', colorless_img)
darker_hsv = img_hsv.copy()
darker_hsv[:, :, 2] = 0.5 * darker_hsv[:, :, 2]
darker_img = cv2.cvtColor(darker_hsv, cv2.COLOR_HSV2BGR)
cv2.imwrite(img_path + 'darker.jpg', darker_img)
tree.jpg
turn_green.jpg
colorless.jpg
darker.jpg
网友评论