Low dimensional embedding of data samples lying on a manifold can be performed using locally linear modeling. By incorporating suitable locality constraints, sparse coding can be adapted to modeling local regions of a manifold. This has been coupled with the spatial pyramid matching algorithm to achieve state-of-the-art performance in object recognition. In this paper, we propose an algorithm to learn dictionaries for computing local sparse codes of descriptors extracted from image patches. The algorithm iterates between a local sparse coding step and an update step that searches for a better dictionary. Evaluation of the local sparse code for a data sample is simplified by first estimating its neighbors using the proposed distance metric and then computing the minimum ℓ 1 solution using only the neighbors. The proposed dictionary update ensures that the neighborhood of a training sample is not changed from one iteration to the next. Simulation results demonstrate that the sparse codes computed using the proposed dictionary achieve improved classification accuracies when compared to using a K-means dictionary with standard image datasets.