Hello Ramnath,
The centroid measurement applies to the image as a whole. It will only return one measurement. In order for it to return the "centroid" of one particular rectangle in the image, you would need to mask out all of the other rectangles. You could repeat this process for each rectangle, and obtain multiple "centroid" measurements. Creating the masks could be complex, depending on the image.
An easier approach may be to perform a Particle Analysis Report on the thresholded image. Each separate particle would return multiple measurements in the report. These measurements include the Center of Mass X and Center of Mass Y (along with others) for each particle. Keep in mind that any disconnected particle would have a report item. You may need to perform some filtering to remove "noisy" particles (such as Particle Filter to remove particles with area < 1000 or so square-pixels).
Best Regards,
Jesse Downs
Applications Engineering
National Instruments