 <p>This is a typical computer vision task (it might even be AI-complete), so it's not easy. However, there's an excellent opensource C++ library called <a href="http://opencv.org" rel="nofollow">OpenCV</a> which works well with iOS. I even found a <a href="http://www.aishack.in/2010/07/tracking-colored-objects-in-opencv/" rel="nofollow">tutorial</a> about detecting a colored object.</p> <p>The basic algorithm is, by the way, something like this: go through each pixel and see if it's red or not (you can do this by comparing it agains some kind of threshold value of the red, green and blue components). If this is done, grab the pixels which were good and figure out where the continuous area they're in is. A method for this would be counting the pixels, then assuming they form a circle, then dividing their number by pi and getting the square root - this would tell you the radius of the circle, that you can double for obtaining its diameter ("width").</p>