The purpose of the double() there is to prevent BW from being a logical matrix, because if BW is a logical matrix then regionprops() will automatically do an object labeling, whereas you just want the total (I guess?) Or if youwant clusters to be analyzed then
regionprops( logical(BW), 'Area')
and that will return a structure array that you can later total the areas of.
Best Answer