When calculating an "IntensityCentroid"
with ComponentMeasurements
, i.e. for an image $I$ and set of components $C$, calculating:
ComponentMeasurements[{C, I}, "IntensityCentroid"][[All, 2]]
Is there an easy way for me to threshold or manipulate the underlying pixel values used to compute the intensity centroid? Specifically, I would like to subtract the minimum or mean pixel value in the region defined by the morphological component from all other pixel values in that region, or Floor (i.e. set to zero) pixel values below a certain threshold. Again, I would like to do this locally in the context of each morphological component rather than globally on the image $I$. Is this possible without a lot of work?
Motivation: Say you're attempting to determine the center of some object to sub-pixel accuracy. If you have a significant amount of "local" background noise (s.t. global thresholding works poorly), a calculated "IntensityCentroid"
will be biased towards the "Centroid"
of the morphological component, and this will become worse with the morphological component's size (relative to the size of the object of interest). As such, it would be fantastic to be able to manipulate and do local thresholding on pixels strictly in the region defined by a particular morphological component.
Here is an example image (a 450 x 449 pixel PNG file):