필터 지우기
필터 지우기

Find centroid of binary image

조회 수: 65 (최근 30일)
Adisorn Phanukthong
Adisorn Phanukthong 2017년 1월 29일
댓글: DGM 2024년 5월 20일
I want to know find centroid area in picture output show X,Y axis
Sample
centroid x 60 centroid y 40

답변 (2개)

Guillaume
Guillaume 2017년 1월 29일
Either use regionprops:
stats = regionprops(yourimage);
centroid = stats.centroid;
Or calculate it yourself according to its definition, the mean of the pixel coordinates:
[y, x] = ndgrid(1:size(yourimage, 1), 1:size(yourimage, 2));
centroid = mean([x(logical(yourimage)), y(logical(yourimage))]);
  댓글 수: 12
Bradley Rogers
Bradley Rogers 2024년 5월 19일
Got codegeneration and tried to make a C++ file, Centroid cant be converted over?
DGM
DGM 2024년 5월 20일
I'm going to have to tap out once it comes to code generation stuff. I'm not familiar with what will build. I haven't really touched it, and I'm running old enough stuff that it would be moot even if I had.

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


Walter Roberson
Walter Roberson 2017년 1월 29일
regionprops() and ask for Centroid

Community Treasure Hunt

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

Start Hunting!

Translated by