Skip to content

Instantly share code, notes, and snippets.

@julianoBRL
Created May 29, 2024 18:49
Show Gist options
  • Save julianoBRL/659bfaa099c0fe347f02979e77f17e57 to your computer and use it in GitHub Desktop.
Save julianoBRL/659bfaa099c0fe347f02979e77f17e57 to your computer and use it in GitHub Desktop.
Converter from RGB to HSV
# Python programs to find
# unique HSV code for color
# Importing the libraries openCV & numpy
import cv2
import numpy as np
def RGBtoHSV(red,green,blue):
color = np.uint8([[[blue, green, red]]])
hsv_color = cv2.cvtColor(color, cv2.COLOR_BGR2HSV)
return hsv_color
def RGBtoHSV2(red,green,blue):
hsv_color = RGBtoHSV(red,green,blue)
return hsv_color[0][0][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment