how to remove speckles from image?
Show older comments
Hi All
i have an image . its a pupil image of an optical system. If i use a large aperture in front of my source ( 200 um-so a finite source), then my image at pupil looks uniform and i can easily see defects/contamination in the image. however if i use a much smaller apertur right in front of my source ( 6um), then in my pupil I see lots of laser speckle shape features . The algorithm I use for detecting defects works based on intensity drop, so the problem i have is that now algorithm gets confused and also takes speckles too as defects. i have example images ( please look at attached images, i have circled what i mean by defects and i want to only detect those). I think this phenomenan happens due to diffraction and nature of light. since small aperture makes my light source work light somewhat coherent light and causes diffraction so all features in the lens system can be seen. I hve averaged several images too but didnt work.
i have asked suport in matlab that what they told me but i am still not successful. I am not that good at matlab and am struggling. I would appreciate any help
"After reviewing the images, it seems that a a lot of the specks you mention can be handled by using morphological operations:
In addition, you can get a full list of all types of morphological filters available here:
The exact sequence of commands needed is hard to predict and it's something you will have to experiment with.
As a recommendation thresholding along with "imerode" and "imdilate" could help in the process.
With that being said, here is a page with a list of all available feature extractors that you can use:
"
thanks very much
11 Comments
Image Analyst
on 8 Jun 2020
Attach the original images, rather than screenshots.
Akram
on 8 Jun 2020
Image Analyst
on 8 Jun 2020
"i have circled what i mean by defects and i want to only detect those" <== where are these circles? I see the circular field of view, and three gray circles between the lower images but I'm not sure what you want to detect and what you want to ignore. Do you just want to locate the dark spots on the light field of view? Have you tried flattening the image with adapthisteq() and then doing a global threshold?
Akram
on 8 Jun 2020
Akram
on 8 Jun 2020
Akram
on 9 Jun 2020
Image Analyst
on 9 Jun 2020
So, I guess you now see why I suggested adapthisteq() followed by thresholding rather than the edge detection like your colleagues. Are your colleagues very experienced in image processing? Because saying to do edge detection is often the first thing novices suggest. There are several problems with edge detection that make it not suitable for this situation that a more experienced image analyst would have foreseen. So try it my way now and let me know how it goes.
Akram
on 9 Jun 2020
Bjorn Gustavsson
on 9 Jun 2020
Well the filtering you want to achieve is to keep structures with smaller spatial scales that have some magnitude above the speckle-level while reduce the speckles. That is kind-of the strength of the Lee's sigma-filter, wiener2 in matlab. At first I didn't think that would be the way forward considering the size of the speckles. However, if you force wiener2 to work with a set level for the noise it seems to work OK:
Im = double(imread('small.png'));
subplot(2,2,1)
imagesc(Im)
subplot(2,2,2)
D = wiener2(Im,[55,55],10000000/6);
imagesc(D)
subplot(2,2,3)
D = wiener2(wiener2(Im,[35,35],10000000/6),[35 35],1000000);
imagesc(D)
subplot(2,2,4)
D = wiener2(wiener2(Im,[35,35],10000000/6),[25 25],1000000);
imagesc(D)
So as you can see it is well possible to reduce/supress the speckles.
HTH
Akram
on 9 Jun 2020
Bjorn Gustavsson
on 9 Jun 2020
Ok, then I move it to an answer. Great that it worked. Obviously you'll have to tweak the filter-settings and check that it behaves as you want it to...
Accepted Answer
More Answers (1)
Bjorn Gustavsson
on 8 Jun 2020
0 votes
If your solution is not to use a large apperture (Why? The example you've shown us seems to work for the large apperture.) then you might get something out of trying to remove the speckles in the Fourier-domain, this might work or not. You might want to window your image giving it a smooth transition from image to black background before doing the fft. Then you might have to suppress the frequency components corresponding to the speckles - this will be tricky since your objects-of-interest have very sharp edges and therefore a wide Fourier-spectrum. But I would give it a try.
HTH
1 Comment
Bjorn Gustavsson
on 8 Jun 2020
Well, then you might find the attached function usefull, it is an implementation the interference-removal filter in chapter 5.7 of Gonzalez and Woods Digital Image Processing (1993). It should have a decent help-information. It might work for this case but I cannot guarantee a success.
Categories
Find more on Image Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
