Eric Guérin and his team have released their terrain amplification method on GitHub.
Terrain amplification implementation in Matlab as described in: Sparse representation of terrains for procedural modeling Eric Guérin, Julie Digne, Eric Galin, Adrien Peytavie Computer Graphics Forum. Volume 35, number 2. Proceedings of Eurographics 2016, Lisbon.
You must install ompbox and ksvdbox in order to execute this code.
When using too small values for offset or mask size, or too large images as exemplar, you could have memory issues.
You find the project and learn more about it here.