how i get the pixel value at the centroid of image
i did as below
cn = s(1).Centroid;rc = round(cn);pixelValue = img(rc(1),rc(2));
but in some cases error is shown as
Index exceeds matrix dimensions.
Error in exe_demo (line 73)pixelValue = img(rc(1),rc(2))
But the centroid point is plotted correctly. How to get the pixel value at that point without error.
Best Answer