MATLAB Answers

how to remove speckles from image?

10 views (last 30 days)
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

Show 8 older comments
Bjorn Gustavsson
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
Akram on 9 Jun 2020
thanks very much Bjorn. It works great. I am not sure how to vote it as accepted answer but thanks a lot!
Bjorn Gustavsson
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...

Sign in to comment.

Accepted Answer

Bjorn Gustavsson
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

  0 Comments

Sign in to comment.

More Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 8 Jun 2020
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
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.

Sign in to comment.

Products


Release

R2018a