implement color correction

This commit is contained in:
Lucca Ketterer 2021-04-26 22:38:05 +02:00
parent 9eaf33aea1
commit 74b5f83998

View File

@ -72,7 +72,7 @@ def get_base_color(color):
_r,_g,_b = 0,0,0
def vibrant(r,g,b):
intensity = 100 # usabel range 1-100 max:1000
intensity = 50 # usabel range 1-100 max:1000
intensity = 1+intensity/1000
rgb = [r,g,b]
@ -96,9 +96,8 @@ def ambient_light_thread():
brighness = 1
while True:
# P-Regler
r,g,b = [w+((y-w)*0.05) for y,w in zip((_r,_g,_b),(r,g,b))]
print(int(r), int(g), int(b))
print(_r,_g,_b)
r,g,b = [w+((y-w)*0.08) for y,w in zip((_r,_g,_b),(r,g,b))]
print(int(r), int(g), int(b), '\033[0;35;40m', _r,_g,_b, '\033[0;37;40m')
send(rgb_to_hex(int(r*brighness),int(g*brighness),int(b*brighness)))
time.sleep(0.01)
@ -113,6 +112,10 @@ def ups():
ups = ups_counter/time_d
print(ups)
def color_correction(r,g,b):
amp = [1,1,0.8]
return int(r*amp[0]), int(g*amp[1]), int(b*amp[2])
def ambient_light():
t = Thread(target=ambient_light_thread)
@ -120,7 +123,6 @@ def ambient_light():
global _r,_g,_b
amp = [1,1,0.8]
counter = 0
start_time = time.time()
while True:
@ -144,7 +146,8 @@ def ambient_light():
# find dominant color
img.thumbnail((2,2))
r,g,b = img.getpixel((0, 0))
_r,_g,_b = vibrant(r,g,b)
r,g,b = vibrant(r,g,b)
_r,_g,_b = color_correction(r,g,b)
time.sleep(0.05)