Skip to content

Instantly share code, notes, and snippets.

@vardanagarwal
Created February 11, 2020 16:46
Show Gist options
  • Save vardanagarwal/3ac21da034e81268e5a3920b6e19d9dd to your computer and use it in GitHub Desktop.
Save vardanagarwal/3ac21da034e81268e5a3920b6e19d9dd to your computer and use it in GitHub Desktop.
import cv2
import numpy as np
img = cv2.imread('Paris.jpg')
image_HLS = cv2.cvtColor(img,cv2.COLOR_BGR2HLS) # Conversion to HLS
image_HLS = np.array(image_HLS, dtype = np.float64)
daylight = 1.15
image_HLS[:,:,1] = image_HLS[:,:,1]*daylight # scale pixel values up for channel 1(Lightness)
image_HLS[:,:,1][image_HLS[:,:,1]>255] = 255 # Sets all values above 255 to 255
image_HLS = np.array(image_HLS, dtype = np.uint8)
image_RGB = cv2.cvtColor(image_HLS,cv2.COLOR_HLS2BGR) # Conversion to RGB
cv2.imshow("original", img)
cv2.imshow("Output", image_RGB)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment