필터 지우기
필터 지우기

Calculation of centroide of an object in image

조회 수: 11 (최근 30일)
Beatriz
Beatriz 2024년 5월 11일
답변: Image Analyst 2024년 5월 11일
Hello everyone
i am currently working on a school project of medical image. I have an x-ray image of a head in lateral position with a brain tumor. i have to calculate the centroide of this tumor. the tumor has an higher contrast however so does other objects in the image. how can i do it?
thank you everyone in advance.
i don't have much experience with matlab so i am a bit in a struggle
  댓글 수: 4
DGM
DGM 2024년 5월 11일
편집: DGM 2024년 5월 11일
What exactly do you mean when you say "higher contrast"? I'm no radiologist, but from the handful of images I've played with, I wouldn't think local contrast (i.e. a measure of variation) would abnormally high in tumor regions. A lot of the tumor images I've seen have very low contrast in tumor regions.
Maybe when you say "higher contrast" you mean the brighter regions? (Maybe that's a difference between radiology terms and more general image processing terminology). It might still be ambiguous, as there are also other bright regions, but we need to know which bridge we're even trying to cross.
Also, does the process need to be automated, and if so, to what degree?
DGM
DGM 2024년 5월 11일
I'm going to throw this out there based on the assumption I mentioned. This is not entirely automated, but the interactive part means I can't run it on the forum.
% read the image
inpict = imread('image.jpeg');
inpict = im2gray(inpict); % grayscale
% manually create a crude polygon selection loosely around the tumor
% it only needs to include the tumor and exclude non-tumor bright regions
imshow(inpict);
ROI = drawpolygon(gca);
roimask = createMask(ROI);
% threshold the entire image
% based on the intensity distribution in the ROI
thresh = graythresh(inpict(roimask));
mask = imbinarize(inpict,thresh);
% refine the mask by excluding blobs outside the roi
mask = mask & roimask;
% select the largest blob in the mask
mask = bwareafilt(mask,1);
% should the holes in the blob be left open or not?
% i'm going to fill them.
mask = imfill(mask,'holes');
% show the mask
imshow(mask)
% get the centroid (or other properties)
S = regionprops(mask,'centroid');
% plot the calculated centroid on the original image
figure
imshow(inpict); hold on
plot(S.Centroid(1),S.Centroid(2),'gx','markersize',20,'linewidth',3)
Otherwise, trying to find any tumor in any image without the constraint provided by the human guidance is not a simple problem.

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

답변 (1개)

Image Analyst
Image Analyst 2024년 5월 11일
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
Also, see my attached demo. Adapt as needed.

Community Treasure Hunt

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

Start Hunting!

Translated by