How to save X ,Y coordinates in a structure?
Show older comments
Helo, I am looking for help.
I have an image I that has several different regions on it.
I calculated the weighted centroids and standard deviation of those regions. Then I want to extract X and Y coordinates of a region on a image that has the maximum standard deviation in that structure, but I am having troubles doing that.
I have done this so far
I calculated the Std:
s = regionprops(BW, I, {'WeightedCentroid','PixelValues');
for k = 1 : numObj
s(k).StandardDeviation = std(double(s(k).PixelValues)); #I calculated the std of these regions
end
Then I tried to get the max value od std in structure but no luck.
This is how I did it:
sStd = [s.StandardDeviation];
MaxStd = find(max(sStd));
imshow(I);
hold on;
for k = 1 : length(MaxStd)
rectangle('Position', s(MaxStd(k)).BoundingBox, ...
'EdgeColor','g');
end
hold off;
I hope that I was clear with the explanation. This maybe seems somehow trivial, but I just can not find the solution. Can anyone help me? Thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!