Some help with segmentation?

2 次查看(过去 30 天)
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.

回答(2 个)

Image Analyst
Image Analyst 2019-9-25
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 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2019-9-25
@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!

请先登录,再进行评论。


MARIA RODRIGUEZ SANZ
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 个评论
Image Analyst
Image Analyst 2019-9-25
Maybe try the triangle threshold like in the attached function.
MARIA RODRIGUEZ SANZ
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!

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by