1. You have not specified what is the problem with your code. I guess that it runs, but does not find the blue point.
2. I think the problem comes from the characteristic of a color to be "blue". Let a point be colored as r = 4, gr = 5, b = 128. That point seems to be "blue". Thus, I guess the conditions on the catched r, gr, and b values should be changed. Maybe an alternative test could be, that the value of b, be much more than the values of r and gr.