Problem with diff operating on a row vector from regionprops
Afficher commentaires plus anciens
Hello, I have an image which consists of 4 spots that I apply regionprops to:

area_measurements = regionprops(BW2,I,{'Area','Perimeter','MajorAxisLength','MinorAxisLength','Orientation','Eccentricity'});
I want to remove any spots that are different to the others. e.g the top left spot
I decided to use Major and Minor as my metric.
allMajor=[area_measurements.MajorAxisLength]
allMinor=[area_measurements.MinorAxisLength]
allMajor =
272.44 227.15 264.20 264.85
allMinor =
197.26 81.16 185.93 205.54
And then combine them, so
MM=[allMajor.*allMinor]
MM =
53742.57 18435.82 49121.64 54437.08
and then calc their differences to be able to remove the worst one. (I was thinking to remove the one with the largest difference and then take the mean)
y=diff(MM)
But this gives me an error:
Array indices must be positive integers or logical values.
I can't see why this is the case.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!