edsheut

RGB2HSV

Oct 17th, 2020
648
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. import numpy as np
  3. import cv2
  4.  
  5. blue = sys.argv[1]
  6. green = sys.argv[2]
  7. red = sys.argv[3]  
  8.  
  9. color = np.uint8([[[blue, green, red]]])
  10. hsv_color = cv2.cvtColor(color, cv2.COLOR_BGR2HSV)
  11.  
  12. hue = hsv_color[0][0][0]
  13.  
  14. print("Lower bound is :"),
  15. print("[" + str(hue-10) + ", 100, 100]\n")
  16.  
  17. print("Upper bound is :"),
  18. print("[" + str(hue + 10) + ", 255, 255]")
RAW Paste Data