This paper presents a computer algorithm for automatic quantification of HMAs in a color retinal image. The algorithm begins with an image quality test. If the image is determined to be useful (normal), image processing and pattern recognition techniques are then applied. The image processing techniques employed are designed to achieve three purposes, image enhancement, noise removal, and most importantly, image normalization. It is followed by the detection of (1) optic disc and macula, (2) flame and blot hemorrhages, and (3) dot hemorrhages and microaneurysms. A special polar coordinate system centered at the macula is proposed. Such a coordinate system is particularly attractive in describing the location of a lesion relative to the center of the macula. In addition, it can be viewed as a 'spider net' and thus can be used to catch hemorrhages of large size, e.g., flame and blot hemorrhages, they way a spider net to catch insects. The spider net, however, will not work for the detection of microaneurysms and dot hemorrhages, because their sizes are too small to be caught by the net. A method specially designed for the detection of microaneurysms and dot hemorrhages is presented. It uses a sequence of seven automatically globally- thresholding binary images, obtained from the pre-processed normalized image, and a set of matched filters using only binary coefficients for differentiating HMAs and blood vessels. At the end, a computer printout of list of all the HMAs detected and their sizes and locations is given. Over four hundred color fundus photographs including standard fundus photographs are used to test the system. It should be pointed out that the sensitivity of this system can be adjusted by the user. By comparing the computer detected and quantified HMAs with the manual counts, it is found that the results are quite satisfactory. Therefore, we conclude that with the sensitivity of the system adjusted to human experts, this system can provide an automatic, objective, and repeatable way to quantify HMAs accurately.