フィルターのクリア

Error using * Too many input arguments.

3 ビュー (過去 30 日間)
saravanakumar D
saravanakumar D 2013 年 12 月 31 日
コメント済み: Walter Roberson 2013 年 12 月 31 日
Error using * Too many input arguments.
Error in triangle (line 9) ratio=c.Perimeter^2/(4*pi*c.Area);
I am getting the above error,I have binary image of triange, so i want use perimeter area ratio to detect the shape, but unfortunately i get this error. I don't know why.

採用された回答

Walter Roberson
Walter Roberson 2013 年 12 月 31 日
Your "c" is a structure array, so c.Area is expanding to multiple arguments.
ratio = [c.Perimeter].^2 ./ (4 * pi * [c.Area]);
  2 件のコメント
saravanakumar D
saravanakumar D 2013 年 12 月 31 日
編集済み: saravanakumar D 2013 年 12 月 31 日
It's working thank You.
Can you please tell me. why we use [] and .
Walter Roberson
Walter Roberson 2013 年 12 月 31 日
When you have a structure array "c", then c.Area is the same as if you had written out
c(1).Area, c(2).Area, c(3).Area, ... c(end).Area
all as individual arguments to the function. When you use [c.Area] then this becomes
[c(1).Area, c(2).Area, c(3).Area, ... c(end).Area]
and so becomes the vector containing all of the various c(K).Area values.
When you are using regionprops, you get a separate structure array entry for each region that regionprops finds. If you get back (say) 3 areas, then the areas will not be stored as [c.Area(1), c.Area(2), c.Area(3)] and are instead stored as c(1).Area(1), c(2).Area(1), c(3).Area(1) -- three separate vectors, not a vector with three entries. Using [c.Area] puts all the entries together into a single vector.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by