Image ROI Label Issue
Show older comments
Hello,
I currently have a code which outputs images, I would like to label different ROI within these images using consecutive numbers. I have written some code to compute the centroid of the ROIs within the image that I would like to label, this data is stored in "props".
"props" is a 1 x 4 cell (I have 4 images, each cell corresponds to a different image). Each of the cells in "props" contains a 5 (the current images have 5 different ROI each) x 1 struct with 2 fields (Centroid Position and Mean Intensity). Here is the code I have thus far:
for i = i:length(props)
imagesc(boutput{1,i});
axis image
colormap('gray')
end
labelShiftX = -7; %simply for aligning number placement
for k = length(props{1})
cent = props{k}.Centroid;
text(cent(1) + labelShiftX, cent(2), num2str(k));
end
To note, "props" was generated using the regionprops function which takes in boutput and output, the binarized and original images, respectively.
So far, my code is not accomplishing the task and the ROIs within the image are not labeled. Any suggestions on how to proceed?
Thank you for your time and attention!!!!
2 Comments
Image Analyst
on 1 Sep 2017
If props was generated by regionprops(), it's a structure array, not a cell array, and you'd use parentheses, not braces. Or it could be a table if you asked for a table. Please show the entire code.
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!