Some help with segmentation?

3 views (last 30 days)
MARIA RODRIGUEZ SANZ
MARIA RODRIGUEZ SANZ on 25 Sep 2019
Hi!
I would like to segment the cells (the brightest parts) of an image (lots of them).
Unfortunately, some of these cells have very low intensity values in their inner parts (see as an example the region of the orange arrow). This brings difficulties when trying to define a threshold for background subtraction. After numerous tests, I think I'm very close to achieving this goal. However, once again I am not able to.
I've been trying edge, entropyfilt, rangefilt...functions on "restan" image, but without succesful results.
Does anyone have an idea on how to solve this last step(s)?
Here is the code that i'm using to get the subsequent images until the "restan" image.
inthe=histeq(int);
%figure; imshow(inthe)
intheg=imgaussfilt(inthe,4);
%figure; imshow(inthe)
intstd=stdfilt(intheg, true(3));
map=gray; ncol = size(map,1);
minv = min(intstd(:));
maxv = max(intstd(:));
s = round(1+(ncol-1)*(intstd-minv)/(maxv-minv));
rgb_image = ind2rgb(s,map);
intstd16=im2uint16(rgb2gray(rgb_image)); %figure; imshow(intstd16)
resta=imadjust(intheg-intstd16); %figure; imshow(resta)
restan=imnoise(resta, 'speckle',1); %figure; imshow(restan)
I've also attached the original image (int.png)
Thank you very much in advance!!!
Maria.

Answers (2)

Image Analyst
Image Analyst on 25 Sep 2019
All that code you did does not do anything for getting a threshold - it's all unnecessary. You don't need to blur, rescale intensities, detect edges, or add noise.
Have you tried imbinarize()?
Or else try my interactive thresholding app: in my File Exchange
  1 Comment
KALYAN ACHARJYA
KALYAN ACHARJYA on 25 Sep 2019
@Maria, refer the suggestion from Image Analyst sir.
How you determine the accuracy of segmentation result in this case? Is there any expeted output?
Looking for input single image, you can do the segmentation in multiple ways.
Good Luck!

Sign in to comment.


MARIA RODRIGUEZ SANZ
MARIA RODRIGUEZ SANZ on 25 Sep 2019
Dear Image Analyst.
Thank you four your answer!
I know that my code does not do anything for getting a threshold. It is precisely because a simple image thresholding does not work on my images... :(. As I specifed above, some cells have very low intensity values in their inner parts and are labelled as background. Moreover, I have huge intensity range between images and I want (must) to avoid appliying different thresholds for each image. That's why I have renounced to use thresholding....
So you have an idea of what I'm talikg about, I attached 3 different original images...
Maria!
  2 Comments
Image Analyst
Image Analyst on 25 Sep 2019
Maybe try the triangle threshold like in the attached function.
MARIA RODRIGUEZ SANZ
MARIA RODRIGUEZ SANZ on 26 Sep 2019
Dear Image Analyst,
First of all, thanks for your interest and help.
I've tried triangle_threshold in my images and some problems arosed:
1)
Undefined function or variable 'WarnUser'.
Error in triangle_threshold (line 178)
WarnUser(errorMessage);
I just replace de "WarnUser" function with "warning" function. and...ok
2)
Warning: Error in program triangle_threshold, function triangle_threshold(), at line 87.
Error Message:
Undefined function or variable 'MaximizeFigureWindow'.
I just disregarded this code line: MaximizeFigureWindow ..... and ok
3)
Whit all this, I obtained a thresholdLevel of 11 for my image, which I think it's incorrect. As far as I know it shold be a value between 0 and 1. My original images are uint16, maybe this is the problem???
Thanks a lot again!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!