Low Pass Filter to Maintain Edge Information
There are many "Edge Preserving" filters in the image processing world.
2 very popular would be:


The Bilateral Filter.
Anisotropic Diffusion Filter.


Google search on each of the terms will give you plenty of data and code samples of each.

For any specific question about them, let me know, I'd be happy to assist.