Makefile creates build directory if needed.
Read how cv::Mat works. Oh, so it's actually a pointer. Oops.
Use references and shared_ptr and stop leaking memory like a collander.