How to normalise histogram peaks in image?

just to expand, I used template matching and then used inpainting. the results were horrible. Like I can’t remove those patterns (literally) as they are valuable for the second operation.

But, I am confused what I can use more now