Skip to content

Instantly share code, notes, and snippets.

@samyumobi
Created November 13, 2021 13:33
Show Gist options
  • Select an option

  • Save samyumobi/3d40214592a01bf83ccfebf5b350c088 to your computer and use it in GitHub Desktop.

Select an option

Save samyumobi/3d40214592a01bf83ccfebf5b350c088 to your computer and use it in GitHub Desktop.
## Load the image
f3 = sys.argv[1]
img3 = img
## convert image to grayscale and display img
img3_gray = cv2.cvtColor(img3, cv2.COLOR_BGR2GRAY)
cv2_imshow(img3_gray)
## histogram equalization of color images
img3c = cv2.cvtColor(img3,cv2.COLOR_BGR2YUV)
## equalize the pixels across y channel and display
img3c[:,:,0] = cv2.equalizeHist(img3c[:,:,0])
## convert equalized image to grey scale
img3h = cv2.cvtColor(img3c,cv2.COLOR_YUV2BGR)
cv2_imshow(img3)
cv2_imshow(img3h)
cv2.waitKey()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment