I think the main problem for you is to find a good path of pixels to follow from one end of your curve to the other. Once you have decided this path, you can just follow it and check the pixel colors as you go.
For now, I would suggest you input the path yourself by specifying a set of waypoints. Here is some code for your example figure. I took the first point in the left purple disc, the second at the angle, and the last one in the bottom-right purple disc.
from PIL import Image
from numpy import array, arange
im = Image.open("aqoGkjs.png")
rgb_im = im.convert('RGB')
def get_color_at(p): # color function as mattsap suggested
r, g, b = rgb_im.getpixel(tuple(p))
if r > g and r > b:
return 'Purple'
elif r < 10 and g < 10:
return 'Blue'
return 'Cyan'
colors = []
via_points = [array([25, 65]), array([185, 44]), array([240, 210])]
for i in xrange(len(via_points) - 1):
for x in arange(0, 1, 0.01):
p = x * via_points[i] + (1 - x) * via_points[i + 1] # linear interpolation
cur_color = get_color_at(p)
if cur_color == 'Blue': # ignore borders
continue
if not colors or cur_color != colors[-1]:
colors.append(cur_color)
print colors
It prints:
['Purple', 'Cyan', 'Purple', 'Cyan', 'Purple', 'Cyan', 'Purple', 'Cyan', 'Purple', 'Cyan', 'Purple', 'Cyan', 'Purple', 'Cyan', 'Purple', 'Cyan', 'Purple']
For your big image, you can input all the waypoints by hand. Or try to make a smart piece of code to find them automatically ;)