Friday 12 January 2018

matlab - artifacts in processed images

itemprop="text">

This question is related to my
previous post href="https://stackoverflow.com/questions/10863734/image-processing-algorithm-in-matlab">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:



src="https://i.stack.imgur.com/5hM3u.png" alt="enter image description
here">



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




src="https://i.stack.imgur.com/QO2yM.png" alt="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
):



src="https://i.stack.imgur.com/0dPEl.png" alt="image1">
src="https://i.stack.imgur.com/8rzW1.png" alt="image2">
src="https://i.stack.imgur.com/gjUcq.png" alt="image3">
src="https://i.stack.imgur.com/UiuKK.png"
alt="iamge4">




And here is the
black background:



src="https://i.stack.imgur.com/ENVl1.png" alt="blackbackground1">
src="https://i.stack.imgur.com/RCx97.png" alt="blackbackground2">
src="https://i.stack.imgur.com/JcW9X.png"
alt="blackbackground3">


itemprop="text">
class="normal">Answer



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



src="https://i.stack.imgur.com/CZjIX.png" alt="Filtered
Image">



And this shows the pixels affected by
the filter



src="https://i.stack.imgur.com/lhBth.png" alt="Pixels affected by
filter">



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...