Microscope image Matlab processing

Hi everyone
i'm trying to analyze microscope images with Matlab.
  • What i would like:
Starting from an image, like img_di_partenza (attached, not the original resolution), i would like to filter it and highlight only the fibers.
  • What i managed to achieve
  1. - First thing, i do is bring the grayscale image with rgb2gray.
  2. - Increase the contrast with imadjust
  3. - Finally I have set 'manual threshold'.
I get more or less something like img_pos_elabora image.
NB. the two images uploaded are not the same, they are an example.
Problems
- The result has a high 'signal to noise ratio'.
- I have many images and therefore I would like to automate everything (I would like to skip the step of the manual threshold).
Can someone help me?
TY everyone

 Accepted Answer

So you'll have to come up with an autothreshold algorithm. There are some in MATLAB such as imbinarize() and graythresh(). I'm also attaching my triangle threshold routine, which is very good for skewed histograms like you most commonly see. You can of course develop your own custom one if you want.

8 Comments

Thank you for your time.
I tried using your function, but i don't know if i understand how it works.
%%%-----------thresholdLevel = triangle_threshold(pixelCounts, side, showPlot)-------------%%%
What i have done:
My Input:
pixelCounts: --> instogram black&white image
side: --> 'R'
showPlot: --> 'true'
error: %%--- Unrecognized function or variable 'WarnUser' --%%
where am i wrong?
TY
It threw an error for some reason. WarnUser is just basically this
function WarnUser(message)
uiwait(warndlg(message));
but I'm attaching the actual function. But we really need to figure out why it's throwing the error in the first place. You can set a breakpoint on WarnUser and see the error message before it ever gets sent to WarnUser.
@Image Analyst Hello sir, Is it possible to determine the Modulation transfer function of an image using matlab? If so, could you guide me through it? I have an image from a microscope, I have determined the resolution using the USAF chart but I dont know how to proceed further.
Basically you have to plot the contrast of the bars as a function of spatial frequency of the bars. There's probably some File Exchange submission that makes it easier. Personally I don't have anything. You can use improfile() or just indexing if you know the location of the bars.
A = imread('image.png');
PSF = otf2psf(A);
figure,imshow(PSF,[])
FFT_A = fft(A);
FF_mag = abs(FFT_A )/(length(FFT_A ));
FF_mag = (FF_mag-min(FF_mag))./(max(FF_mag)-min(FF_mag));
FF_mag_nw = FF_mag(1:(length(FFT_A)/150));
plot(FF_mag_nw);
@Image Analyst: Does this catch your reason?
Uh, no. Your image is not the OTF. You need to construct the MTF by doing what I said - taking profiles across the different spatial frequencies and looking at the contrast.
Get profile across wide bars, compute the contrast, then this is one point on the MTF.
Then repeat for the next thnner set of bars and you get another point.
Repeat for all sets of bars that you have.

Sign in to comment.

More Answers (0)

Products

Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!