One short remark to this piece of code from David:
label_fg delivers an image with {iM} labels, hence repeat needs {iM} loops. Otherwise the last labelled object will not be processed.
One short remark to this piece of code from David:
label_fg delivers an image with {iM} labels, hence repeat needs {iM} loops. Otherwise the last labelled object will not be processed.