Please see the following blog post for more details about this code
Read an Image in OpenCV ( Python, C++ )