How to show area on image?

3 visualizzazioni (ultimi 30 giorni)
Ayesha ch
Ayesha ch il 22 Mag 2016
Commentato: Ayesha ch il 24 Mag 2016
Hi, I'm using region props to calculate area,convex hull and euler number of every component in an image, but I don't know which element of the resulting array corresponds to which component. Is there a way that I could display the area of each component on the image as it is very confusing for me to find out which component is in column 1 or 2. Any help would be appreciated.

Risposte (1)

Image Analyst
Image Analyst il 22 Mag 2016
Note how I ask regionprops for the centroids and then I use text() to place a label at each centroid. That's one way. If you were thinking of something else, like overlaying a colored patch or outline, let me know.
  1 Commento
Ayesha ch
Ayesha ch il 24 Mag 2016
Thank you so much for such a fast reply. I'm having a little difficulty understanding the text function. As I'm trying to display the area I tried
allAreas = [cvx.Area];
for k = 1 : size(allAreas) % Loop through all blobs. text(double(allAreas(k)) + labelShiftX, num2str(k), 'FontSize', textFontSize, 'FontWeight', 'Bold');
end
But I'm getting an error that first three must be double values. Am I supposed to give x and y co ordinates too and how? Kindly explain

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by