Created
February 10, 2020 20:38
-
-
Save vardanagarwal/4ef33e656fb7ad033ac719dd23e92480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
img = cv2.imread('Paris.jpg') | |
original = img.copy() | |
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # convert image to HSV color space | |
hsv = np.array(hsv, dtype = np.float64) | |
hsv[:,:,1] = hsv[:,:,1]*1.25 # scale pixel values up for channel 1 | |
hsv[:,:,1][hsv[:,:,1]>255] = 255 | |
hsv[:,:,2] = hsv[:,:,2]*1.25 # scale pixel values up for channel 2 | |
hsv[:,:,2][hsv[:,:,2]>255] = 255 | |
hsv = np.array(hsv, dtype = np.uint8) | |
img = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR) # converting back to BGR used by OpenCV | |
cv2.imshow("original", original) | |
cv2.imshow("Output", img) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment