# How to remove striped noise from this image. Which filter or algorithm use better?

I need to process a gray scale image. The task is to remove the stripes, which constitute some noise. I have next origin image:

This image received many channels ADC(Y) in moment of time (Xn) from a pulse(I think that from It we have stripes on origin image) power supply. First 736 rows is my image. Because my main image(First 736 rows) can have different objects(useful signals e.e. some smartphone or car for example), I have reference channels(without useful signal) for normalize. Last 64 rows is my reference channels(should be "ideal - without noise" and without "test object"). Format of data in pixel is 20 bit(It is custom format).

My first step is normalize(one scale image by axis X).

I normalize next formulae in MATLAB:

X_Mean_main_image_column(1:736,:)) = mean(Input_Image1(1:736,:));
XMean_REF = mean(mean(Input_Image1(737:end,:),2)); %Mean of reference channels
XMean_REF_Column(1,:) = (mean(Input_Image1(737:end,:))); %mean of Xn of reference channels
K = XMean_REF./XMean_REF_Column; % coefficients of scale

for j = 1:width_picture % apply coefficients for each row
gg(j,:) = double(Input_Image1(j,:)).*K;
end


Image after normalize:

Construction has form, that we should receive almost the same ratio(ratio energy references channels to main image(in moment of time X)). It will fact and We miss next questions: Why?, How? But sometimes we have peaks. This peaks show moment of time X, when added noise to signal in reference channels only. This noise often added when value pulse power supply higher than average value.

It is this ratio after normalize:

Therefore, Image after normalize has stripes. I found this when I saw picture ratio (mean value of reference channels( XMean_REF_Column(737:end,:)) to X_Mean_main_image_column(1:736,:))

ratio1 = (XMean_REF_Column(737:end,:))./X_Mean_main_image_column(1:736,:)).


I wanted to know form and frequency of noise. I increased values of reference channels in moment X to the maximum value. I received next ratio(graph). (P.S. It was my mistake because, stripes us noise havent period. They are random.)

How to remove striped noise from this image. Which filter or algorithm use better?

Im sorry for my English. At the end of my question(problem) is conclusion that, Reference channels ADC(64 channel(Ym)) have electronic noise. This 64 channels is last 64 channels. And noise tolerated from reference channels to channel with image.

I am work in company where their field of work is x-ray. And pictures have test objects. I showed image without test object. And median filter doesnt work in situation with test object. Processing signal through median filter.

My task is remove noise in digital view. My colleagues says that this way better and shorter than remove electronic noise.

"Was the "After" image made with the method I described?"

1) Yes. I used your code(I paste in Matlab). Octave Drop-in compatible with many Matlab scripts.

%Filter
% I have data custom format(20 bit)

% #Clip out just the reference section
% [XMIN YMIN WIDTH HEIGHT]
referencestrip = imcrop(Filter_Image_before, [0 247 size(Filter_Image_before,2) size(Filter_Image_before,1)]);

% #Get the average of each column in the reference section
meansOfReferenceStrip = mean(referencestrip,1);

% #Calculate the offset from the interference
% #Using (2^20)/2 because gray scale image values range from 0 to (2^20).
offsets = (2^20)/2 - meansOfReferenceStrip;

% #Correct the image
img1 = Filter_Image_before + offsets;

% #Filter image with a median filter
% #Comment out this line to remove the filtering.
img1 = medfilt2(img1, [20 1]); % for comment
OutputData = img1;

% #Write corrected image to disk
% imwrite(OutputData, "cleaned.png");

% #Show the corrected image on screen
figure, imshow (uint8(round(OutputData/2.^12))) %for png 8 bit(20-12=8)


"I don't know anything about X-ray images. Is the "After" an improvement over the "Before?"

2) No, Because we lost image clarity.

Finish:

I am sorry. I havent power for long answer. Me answer: I made second normalize without reference channel for first value of scale. To set apart background from main image help small classificatory.

• Is each vertical line in the image from a different ADC? That's what it looks like to me, and what I think your text is describing. – JRE Aug 2 at 10:46
• Im sorry. No. Each horizontal line(Ym) is a different ADC in moment of time Xn ( vertical line). – Zhenyabqwe Aug 2 at 12:02
• Ok. Then your noise is the same for all channels. For each time period, calculate the average of all ADC values, subtract that from half of your ADC range, and add that difference to all ADC values for that time slot. I think that'll make things much clearer. – JRE Aug 2 at 15:49
• Ideally though, you would find out what is causing all the interference, and fix the hardware. – JRE Aug 2 at 15:51
• How did it work out? – JRE Aug 19 at 7:54

As I mentioned in the comments, the interference you have seems to affect all ADC channels equally at the same time. Really, the right way to fix this is to find and eliminate whatever is causing the interference - the actual electronic cause. You mention the power supply, but it could be interference from other electronic circuits or cell phones or wifi.

If you can't fix it electronically (or you have a large data set you have already collected and doing it over isn't an option) then you can try to reduce the interference mathematically. Fortunately you have sections of data that contain only the interference but no signal. That makes it possible to measure the interference and remove it from your data.

The way I would go about reducing the interference is to account for it for each time slot. You have 64 channels with no data - the reference channels you mentioned. Calculate the mean of these 64 channels for each time slot. Subtract that from half of the maximum value your data type can represent, then add that to all of the real data samples for that times slot.

I took your data, and applied that method to the one sample image you provided.

This is your image without the white border:

This is the result:

The wild variations from the interference are gone, and you can clearly see what looks like real events scattered through the image.

If you apply a median filter vertically (across the ADC channels) then you get this:

The channels re-enforce each other, and the incidents are more clearly visible. (You may need to download and view the images in a photoeditor - the scaled down versions you will see on the site here mash the details together.)

I used Gnu Octave since I don't have MatLab.

Here's the code I used:

#Read image

#Clip out just the reference section
referencestrip = imcrop(img, [0 247 columns(img) rows(img)]);

#Get the average of each column in the reference section
meansOfReferenceStrip = mean(referencestrip,1);

#Calculate the offset from the interference
#Using 128 because gray scale image values range from 0 to 255.
offsets = 128 - meansOfReferenceStrip;

#Correct the image
img1 = img + offsets;

#Filter image with a median filter
#Comment out this line to remove the filtering.
img1 = medfilt2(img1, [20 1]);

#Write corrected image to disk
imwrite(img1, "cleaned.png");

#Show the corrected image on screen
imshow(img1);


If you want to play with that code, you'll need the "signal" and "control" packages for Octave. Instructions for installing packages here.