OpenCV adaptation of the non-local means Matlab implementation by Dirk-Jan Kroon. (https://www.mathworks.com/matlabcentral/fileexchange/27395-fast-non-local-means-1d-2d-color-and-3d)