Having problem with imread. So I tried the code from the tutorial. Still didn't work. (Image was empty) Changed the libraries to the debug version. Now the tutorial version worked. Using VisualStudio 2012. Tried to embed the same code in an MFC application. Seems to work with the debug libraries. But when I close the program, I get a huge number of memory leaks. Commented out the imread, and the number of memory leaks decreased substantially. Commented out the Mat declaration for the image, and all the memory leaks go away. Just having the Mat declared gives me memory leaks. Using it causes even more memory leaks. There must be some way to destruct the Mat image at program termination to not have any memory leaks. Anybody have any ideas?