Search code examples
matlabimage-processingfilternoise-reduction

artifacts in processed images


This question is related to my previous post Image Processing Algorithm in Matlab in stackoverflow, which I already got the results that I wanted to.

But now I am facing another problem, and getting some artefacts in the process images. In my original images (stack of 600 images) I can't see any artefacts, please see the original image from finger nail:

enter image description here

But in my 10 processed results I can see these lines:

enter image description here

I really don't know where they come from?

Also if they belong to the camera's sensor why can't I see them in my original images? Any idea?

Edit:

I have added the following code suggested by @Jonas. It reduces the artefact, but does not completely remove them.

%averaging of images
im = D{1}(:,:);
for i = 2:100
 im = imadd(im,D{i}(:,:));
end
im = im/100;
imshow(im,[]);

for i=1:100
SD{i}(:,:)=imsubtract(D{i}(:,:),im(:,:))
end

@belisarius has asked for more images, so I am going to upload 4 images from my finger with speckle pattern and 4 images from black background size( 1280x1024 ):

image1 image2 image3 iamge4

And here is the black background:

blackbackground1 blackbackground2 blackbackground3


Solution

  • Here is an answer that in opinion will remove the lines more gently than the above mentioned methods:

    im = imread('image.png');   % Original image
    imFiltered = im;            % The filtered image will end up here
    imChanged = false(size(im));% To document the filter performance 
    
    % 1)
    % Compute the histgrams for each column in the lower part of the image
    % (where the columns are most clear) and compute the mean and std each
    % bin in the histogram.
    histograms = hist(double(im(501:520,:)),0:255);
    colMean = mean(histograms,2);
    colStd = std(histograms,0,2);
    
    % 2)
    % Now loop though each gray level above zero and...
    for grayLevel = 1:255
    
        % Find the columns where the number of 'graylevel' pixels is larger than
        % mean_n_graylevel + 3*std_n_graylevel). - That is columns that contains
        % statistically 'many' pixel with the current 'graylevel'. 
        lineColumns = find(histograms(grayLevel+1,:)>colMean(grayLevel+1)+3*colStd(grayLevel+1));
    
        % Now remove all graylevel pixels in lineColumns in the original image
        if(~isempty(lineColumns))
            for col = lineColumns 
                imFiltered(:,col) = im(:,col).*uint8(~(im(:,col)==grayLevel));
                imChanged(:,col) = im(:,col)==grayLevel;
            end
        end 
    end
    
    imshow(imChanged)
    figure,imshow(imFiltered)
    

    Here is the image after filtering

    Filtered Image

    And this shows the pixels affected by the filter

    Pixels affected by filter