using MATLAB to find area of flourescent region

I have a fluorescent organelle image and i need to find the area of one part of the organelle. How can i get that area?, i tried thresholding but the illlumination is super uneven. I know cropping is my best bet but I need it to be automated for multiple images where the organelle may not be in the same portion of the crop. I was pretty close when I used the following after grayscaling.
enh = imadjust(smooth, stretchlim(smooth, [0.01 0.99]), []);
p = 0.73;
T = quantile(enh(:), p);
BW = enh > T;
imshow(BW);
imfill(BW, "holes");
BW = bwareafilt(BW, 1);
I still cannot fill the cavity completely, but the specific organelle area is the most flourescent its just the holes I am having an issue with. Or is there a way to completely scrap this method and improve my thresholding for the image. I also tried imclose as well but still I had issues.

댓글 수: 4

Please attach one of your images. Please attach a second image showing the outline of the organelle you want to select.
Chiedza
Chiedza 2025년 11월 18일
I have highlighted the region in yellow
At most I see a vague hint that maybe there might be something in the area, but that vague hint is on the order of the dirt on my display, so I don't know if there is anything there or not. The only thing I see in that image is a green-ish dot about 1/4 of the way down and about 2./3 of the way across.
Chiedza
Chiedza 2025년 11월 18일
Heres a better visual of the image enhanced, trying to get the round area only not the trunk

댓글을 달려면 로그인하십시오.

답변 (1개)

Mathieu NOE
Mathieu NOE 2025년 11월 19일
hello
this is a quick and dirty (potential) solution :
  • that does not need the Image P Tbx
  • generated by a non expert in the field...
but I'm always keen to try things
so let's go - assuming your have already converted the original RGB image into either a grayscale (or just take the green channel as it's anyway a green picture)
% load image
A = double(rgb2gray(imread('image2.png')));
% centroid of the "high amplitude area"
[m,n] = size(A);
[y,x] = find(A>max(A(:))-16);
xc = mean(x);
yc = mean(y);
% image gradient
iG = abs(gradient(A));
ind = find(iG>0.25*max(iG(:))); % the threshold value is critical to the result
[yb,xb] = ind2sub(size(iG),ind);
% some coordinates conversions....
xbs = xb - xc;
ybs = yb- yc;
[th,r] = cart2pol(xbs,ybs);
% a trick to find the inner boundary (by taking
% the inverse of the radius)
[xtmp,ytmp] = pol2cart(th,1./r);
k = boundary(xtmp,ytmp,0);
[th,r] = cart2pol(xbs(k),ybs(k));
% take unique values (and sort theta)
[th,ia,ib] = unique(th);
r = r(ia);
% interpolation in polar coordinates
N = 50;
thi = (-pi+2*pi/N:2*pi/N:pi);
ri = interp1(th,r,thi,'spline');
[xbs,ybs] = pol2cart(thi,ri);
xb = xbs + xc;
yb = ybs + yc;
% close the boundary
xb(end+1) = xb(1);
yb(end+1) = yb(1);
figure
imagesc(A)
hold on
plot(xc,yc,'+m','markersize',15)
plot(xb,yb,'*-r','markersize',5)
% use inpolygon to extract the area of interest
[X,Y] = meshgrid((1:n),(1:m));
in = inpolygon(X,Y,xb,yb);
figure
imagesc(A.*in)
% map = [0 0 0;parula(256)]; % display NaN values (points outside the polygon) in black
map = [1 1 1;parula(256)]; % display NaN values (points outside the polygon) in white
colormap(map)

카테고리

도움말 센터File Exchange에서 Biomedical Imaging에 대해 자세히 알아보기

제품

질문:

2025년 11월 18일

답변:

2025년 11월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by