2023-10-23 14:32:35 +00:00
|
|
|
import cv2
|
|
|
|
import numpy as np
|
2023-10-24 02:46:18 +00:00
|
|
|
from pallete_schema import PalleteSchema
|
2023-10-23 14:32:35 +00:00
|
|
|
|
|
|
|
class ComparisonComparison:
|
2023-10-23 20:09:08 +00:00
|
|
|
def __init__ (self) :
|
|
|
|
c = [0, 0, 255]
|
|
|
|
print(c)
|
|
|
|
cc = self.convert_color(c, cv2.COLOR_BGR2RGB, cv2.COLOR_RGB2LAB)
|
|
|
|
print(cc)
|
|
|
|
print(self.convert_color(cc, cv2.COLOR_BGR2LAB, cv2.COLOR_LAB2RGB))
|
|
|
|
|
|
|
|
|
|
|
|
def convert_color (self, color, color_space_a, color_space_b) :
|
2023-10-23 14:32:35 +00:00
|
|
|
pixel = np.zeros([1, 1, 3], dtype=np.uint8)
|
2023-10-23 20:09:08 +00:00
|
|
|
pixel = cv2.cvtColor(pixel, color_space_a)
|
2023-10-23 14:32:35 +00:00
|
|
|
pixel[:] = color
|
2023-10-23 20:09:08 +00:00
|
|
|
cvt = cv2.cvtColor(pixel, color_space_b)
|
2023-10-23 14:32:35 +00:00
|
|
|
return cvt[0, 0]
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
ComparisonComparison()
|