Please see the following blog post for more details about this code applyColorMap for pseudocoloring in OpenCV ( C++ / Python )