Everything works fine, except that cv throws an OutOfMemory exception when
too much files is being load.

Changed the Mat to be load in Grayscale to prevent OutOfMemory exception,
works but still crashes. Might want to resize Mat or crop them.