C++ implementation of a statistical cmage completion algorithm