Final version of Laplacian filter C++ function