Various C++ image processing functions