This paper deals with extraction of fingerprint features directly from gray scale images by the method of ridge tracing. While doing so, we make substantial use of contextual information gathered during the tracing process. Narrow bandpass based filtering methods for fingerprint image enhancement are extremely robust as noisy regions do not affect the result of cleaner ones. However, these method often generate artifacts whenever the underlying image does not fit the filter model, which may be due to the presence of noise and singularities. The proposed method allows us to use the contextual information to better handle such noisy regions. Moreover, the various parameters used in the algorithm have been made adaptive in order to circumvent human supervision. The experimental results from our algorithm have been compared with those from Gabor based filtering and feature extraction, as well as with the original ridge tracing work from Maio and Maltoni . The results clearly indicate that the proposed approach makes ridge tracing more robust to noise and makes the extracted features more reliable.