Hi, Thomas!
Thank you very very much!
I actually found a kind of awkward solution - I use imageio library to extract the rgb values into a nested list in python. The resulting structure is very massive and gets the system stuck. So I iterate over it , removing the background grey ([128,128,128]) pixels and adding the remaining colored pixels to the dictionary ({y, x: [r, g, b]}). Further, to make it even more lightweight, i remove most of the pixels from the left and right side of the wheel, leaving only two pixels for each row(y) - one from the left, and one from the right. the pixels from the top and bottom are left untouched.
__ = imageio.imread('wheel_v7s9_fullsize.png')
wheel_rgb = np.ndarray.tolist(__)
wheel_dict = {}
for y in range(1080):
if y <= 200 or y >= 860:
for x in range(1920):
if wheel_rgb[y][x] != [128, 128, 128]:
wheel_dict.update({str([y, x]): wheel_rgb[y][x]})
else:
row_list = []
for x in range(1920):
if wheel_rgb[y][x] != [128, 128, 128,]:
row_list.append(wheel_rgb[y][x])
row_list[0:20] = []
row_list[20:-20] = []
row_list[-19:] = []
for i, value in enumerate(row_list):
wheel_dict.update({str([y, i]): value})
It works meanwhile. I copy paste this ‘trimmed’ dictionary to the psychojs file as a js object and use the x,y values provided during the response stage as the keys to search for corresponding color value in it.
Do you think I can continue like this?
Thanks a lot !