So your process should be:
Draw the camera's image.
Scan the image for the pixels that are the best match to the first and second colors.
Draw the camera's image.
Scan the image for the pixels that are the best match to the first and second colors.
Record their X and Y positions. (Hint: X1, Y1, X2, Y2.)
Determine the distance between those two points. (Hint: Use the dist() function!)
If the distance is small, (Hint: If( dist( X1, Y1, X2, Y2 ) < someValue ){ )
Then draw something near them (Hint: imageMode(CENTER); image( theImage, X1+X2/2.0, Y1+Y2/2.0); )
If the distance is small, (Hint: If( dist( X1, Y1, X2, Y2 ) < someValue ){ )
Then draw something near them (Hint: imageMode(CENTER); image( theImage, X1+X2/2.0, Y1+Y2/2.0); )
That should get you started!
Remember: You don't have to scan the image TWICE! Just ONCE, remembering TWO different "best matching" points.
Remember: You don't have to scan the image TWICE! Just ONCE, remembering TWO different "best matching" points.