I'm implementing a dictionary learning algorithm for doing sparse coding on images and I have a problem how to learn a dictionary corresponding to several iamges.
Let’s say X is the data matrix. If I apply dictionary learning only to one image then X is equal to the image. But what if I want to learn the dictionary for several images ? Should I in this case just put all images into X, i.e. X = [image1, image2, image3…]?
Another approach I thought of was to learn a dictionary for each image separately and then decide online which dictionary to use (by e.g. comparing histograms or some similarity measures to decide to which training image the new input image is most similar to and then choosing the corresponding dictionary).
What appraoch should I use?