필터 지우기
필터 지우기

Can I use regionprops for two different image for finding same feature in same code?

조회 수: 2 (최근 30일)
I want to find centroid for a lesion.But I have found this in previous line of this code.So it shows me some error like 'Expected one output from a curly brace or dot indexing expression, but there were 2 results'. The error is in 5th line when I have used these lines:
props = regionprops(labeledImage, 'Centroid');
xCentroid = props.Centroid(1)
yCentroid = props.Centroid(2)
props1 = regionprops(rotatedImage, 'Centroid');
xnewCentroid = props1.Centroid(1)
ynewCentroid = props1.Centroid(2)

채택된 답변

Adam Danz
Adam Danz 2020년 4월 13일
You're indexing the wrong variable.
xnewCentroid = props1(1).Centroid
ynewCentroid = props1(1).Centroid
See this example to get more experience in using the output.
  댓글 수: 2
joynob ahmed
joynob ahmed 2020년 4월 14일
Sorry, I didn't understand. Can you explain more?
Adam Danz
Adam Danz 2020년 4월 14일
You're getting this error
Expected one output from a curly brace or dot indexing expression, but there were 2 results
because you're indexing incorrectly.
xnewCentroid = props1.Centroid(1)
% wrong ^^^
xnewCentroid = props1(1).Centroid
% correct ^^^^

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by