A fundamental problem in biological and machine vision is visual invariance: how are objects perceived to be the same despite undergoing transformations such as translations, rotations, and scaling? In this paper, we describe a Bayesian method for learning invariances based on Lie group theory. Previous approaches based on first-order Taylor series expansions of inputs can be regarded as special cases of the Lie group approach, which, in principle, can handle arbitrarily large transformations. Using a matrix-exponential based generative model of images, we derive an unsupervised algorithm for learning Lie group operators from input data containing infinitesimal transformations. Our experimental results show that the Lie operators for translations, rotations, and scaling can be learned directly from training images. We demonstrate that these operators can be used to both generate and estimate transformations in images, thereby providing a basis for achieving visual invariance.