フィルターのクリア

How to get the pixel value at centroid point

1 回表示 (過去 30 日間)
Elysi Cochin
Elysi Cochin 2017 年 9 月 20 日
回答済み: Walter Roberson 2017 年 9 月 20 日
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.

採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 20 日
pixelValue = img(rc(2), rc(1));
The centroid coordinate order is X, Y, but image arrays are in the order Y, X.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by