As Kenny already mentioned, “related component labeling” describes a family of algorithms that identify related pixels. Connected components are also called “connected areas” or “blocks”, as well as the associated concept of “circuits”. Any such algorithm should be able to find not only the shape of the connected foreground pixels, but also the presence of “holes” inside the figure, consisting of pixels of the background color.
http://en.wikipedia.org/wiki/Connected-component_labeling
This algorithm is used for several engineering fields that are based on image processing, including computer vision, machine vision, and medical imaging. If you are going to spend some time processing images, you should become very comfortable with this algorithm and implement it at least once yourself.
The OpenCV library has a findContours () function that can be used to search for outlines, outlines within outlines, etc.
http://opencv.willowgarage.com/wiki/
If you want to see the algorithm for marking areas at work, find links to "cell counting" using the ImageJ application. Biological cell counting is an important and often cited application of region labeling for medical imaging.
http://rsbweb.nih.gov/ij/
Consider getting a textbook on this subject, rather than learning in parts online. The study of related components (aka blobs) inevitably leads to the consideration of binarization (the threshold value aka), which takes on shades of gray or a color image and generates a black and white image from it. If you work with images from the camera, the lighting becomes critical, and it takes time and skill to study.
There are many other preprocessing steps that may be required to clean the image. The need for preprocessing depends on your application.
A tutorial is often recommended here, which gives a good overview of standard image processing methods:
Digital Image Processing by Gonzalez and Woods, 3rd Edition http://www.imageprocessingplace.com/
Go to addall.com to find cheap copies. International publications are cheaper.
If the characters (or other shapes) in the image have a consistent size and shape, for example, "A" always has a height of 40 pixels and 25 pixels and prints the same font - then you can use the "normalized cross-correlation" or pattern matching method for identify the presence of one or more matching shapes. This method may work as a very crude form of OCR, but has serious limitations.
http://en.wikipedia.org/wiki/Template_matching