C++ image preprocessing code snippet.