using MATLAB to find area of flourescent region

30 Ansichten (letzte 30 Tage)
Chiedza
Chiedza am 18 Nov. 2025 um 5:26
Beantwortet: Mathieu NOE am 19 Nov. 2025 um 14:41
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 Kommentare
Walter Roberson
Walter Roberson am 18 Nov. 2025 um 19:47
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 am 18 Nov. 2025 um 20:02
Heres a better visual of the image enhanced, trying to get the round area only not the trunk

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Mathieu NOE
Mathieu NOE am 19 Nov. 2025 um 14:41
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)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by