MATLAB Answers

Using a loop to display areas of objects over centroids

2 views (last 30 days)
Anthony Arteaga
Anthony Arteaga on 22 Aug 2019
Answered: Jalaj Gambhir on 27 Aug 2019
I have been given the following task.
"TASK 14: MATLAB works in numbers, but it is often easier for humans to get a lot of information from a
picture rather than looking at lists of numbers. Display the original image and annotate each nuclei with
the area at the centroid of the nuclei.
Hints: You can use the “text()” command to display text on the image. You will need to use a loop and
the “num2str()” command to convert the Area from a number to a string. This will be one of the more
difficult tasks, so feel free to reach out if you need help. Try to break it into small tasks. Can you display
text? Can you label one nuclei at the centroid? Can you repeat this in a loop?"
I have been able to display the centroids and I think I was able to calculate the area using the following code.
BW = (imtophat1 > 55);
regprop=regionprops(BW,'centroid');
centroids = cat(1, regprop.Centroid);
imshow(BW)
hold on
plot(centroids(:,1),centroids(:,2), 'b*')
hold off
regprop2=regionprops(BW,'area');
area_values = [regprop2.Area];
I'm at a loss when it comes to beginning this task. I am hoping I can get some help with some explanation.

  0 Comments

Sign in to comment.

Answers (1)

Jalaj Gambhir
Jalaj Gambhir on 27 Aug 2019
Hi,
You can use insertText which can display text over the image on the position specified. This could annotate the nuclei with the area of the centroid.

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags