This should be quite easy to do in LabVIEW.
There are many ways to do this. I just wired up an example to give you some ideas and get you started. A few simple comments are on the diagram.
For simplicity, I used colors that need to be matched pairwise instead of images and the size is only 4x4. Resize as needed.
You would need to add initial shuffling of the color array, currently the problem is static.
Enjoy.