In some use cases of surface inspection it is necessary to reveal dents or folds on surfaces from images. For that purpose I use OpenCV with a custom filter.
The resulting image can then be used as an input for machine learning with neural networks.
My approach is simple, I compute the difference between a Gaussian evaluation of what should be a pixel if it was matching the surrounding pixels and make the differences visible with a histogram equalization.
I then use a threshold on the image to leave visible only the main folds, and perform suome noise removal before and after with blurs.
Here is the result with a paper sheet I crumpled and the code below. I also tested with dents on car bumpers or plane wings.
# filter to compute dents
# Put your image path here
# Show dents as black on white
for i in range(4):