How to normalise histogram peaks in image?

I have an (.tiff) image which has obnoxious wave patterns. Through logarithmic plot, I can identify the peaks where these waves patterns form, but I am unsure how can I delimit them using OpenCV. I tried equalisation methods from Skimage library but it was fruitful except it just increased and fixed the contrast. I am specifically looking for removing the high peaks from my image.

this is the code, I used for seeing the wave patterns and its corresponding peaks

import numpy as np
import matplotlib.pyplot as plt
from skimage import io

# Load the TIFF image
image = io.imread('TawsifExampleDataApr2024\\SubsetSmallTiffFiles\\img_t1_z1_c1_small_800.tiff')

if len(image.shape) > 2:
    image = np.mean(image, axis=2, dtype=np.uint8)

# Compute histogram
hist, bins = np.histogram(image.flatten(), bins=256, range=[0, 255])

plt.figure(figsize=(10, 5))
plt.semilogy(hist, color='black')
plt.title('Image Intensities (Log Scale)')
plt.xlabel('Intensity')
plt.ylabel('Frequency')
plt.grid(True)
plt.show()

I would appreciate if someone can help me out, thanks! ^^

Original Image

those wave patterns don’t show up in the histogram. messing with the histogram will not help those wave patterns at all.

can you assist me to identify what method will be suitable to remove these wave patterns? Because I tried FFT, inpainting and few others, I am pretty much unsure what I can use more.

Like the wave patterns aren’t exactly white lines like we can except from scans nor it is like really dark lines. If I use FFT, the wave patterns just get darker. I’m really confused and out of ideas. Any help and guidance will mean the world! Definitely appreciate your help a lot!

@crackwitz

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

to remove that, one would need to find out how it happened.

I’m assuming at my lab, while they were creating these slices, there was a delay and this may have caused the patterns. I used montage from ITK library to cascade multiple tiles into this above provided resampled images.

I don’t think, I can go to basic and fix the flaw which resulted in the wave patterns. That’s why, I am looking for algorithms that can remove those wave patterns.

I have read almost everything there was to offer to fix these wave patterns but nothing was close to satisfactory. I even went ahead and used Stable Diffusion in-painting. It was quite bad as well.

Like, I need the detail present in the wave patterns but I don’t want those wave like patterns generated colour that is giving this awe of pattern. If you could guide me, I would be really grateful. @crackwitz

you read the wrong stuff because you put the issue into the wrong words.

that picture is a composite of many smaller images.

each image has “vignetting”.

you compensate for that before stitching them all into a composite. you remove the vignetting in each picture.

you can only do that if you have the original individual pictures.

ideally, you take a picture of “nothing”. “flat-field correction”.

1 Like

Do you recommend, I use flat field correction to every individual image? before stitching them together? Then use those resulted image to stitch into the larger image?