Using a loop to display areas of objects over centroids

1 vue (au cours des 30 derniers jours)
Anthony Arteaga
Anthony Arteaga le 22 Août 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.

Réponses (1)

Jalaj Gambhir
Jalaj Gambhir le 27 Août 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.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by