# Dictionary learning for image classification

I'm wondering if the approach I'm thinking of could even work. I want to use dictionary learning for image classification. The first step would be to learn the dictionary from a set of similar yet different images to be able to extract background from an image. For example, I have a set (e.g. 500 photos) of images of the same object, but the scenes differ (light, the angle the photo was taken at etc.) Basically, the main object is the same, or more precisely, the objects are very similar, they all show the main object. Is it possible to use dictionary learning to model the main object? My next step would be to model the main object (the background) with sparse coding techniques and detect "unexpected" objects. This is so called a contrario approach in object detection problems.

I'm inspired by these publications:

Next, what software would let me do this? I found the mlpack package (for R and Python). It has a function sparse_coding that performs dictionary learning. I tried it on MNIST dataset and I can model digits, denoise them etc. But haven't tried on images of my interest so far. The learning process will take a lot of time, I guess. I took a while for MNIST 28 x 28px images.

Does my experiment has sense? What do you recommend? Do You know any tutorials with code samples I can take a look?