Finding a centroid of an area ( y coord. ) under discrete valued 2D function
조회 수: 8 (최근 30일)
이전 댓글 표시
Hello,
I have a set of discrete pairs ( x , y ) - keys and values - 2D discrete function's samples - a histogram of input digital image that I need to process. ( y = f(x) )
I need to find y coordinate of a centroid of an area under a discrete 2D function ( histogram ) for special image processing after . I found next formulas for continues functions centroid: http://www.intmath.com/applications-integration/5-centroid-area.php
I've tried to calculate y coord. of a centroid using average method for discrete function integration but I'm not sure about computation of y , how to identify x = f-1(y) ( inverted ) and an intervals for computation in discrete case.
How to do that : from having (x,y) discrete pairs set to find the y coordinate of centroid of an area under the function y = f(x) for the given interval [a , b] ( size N )? I need pseudo code or C or Matlab code of calculation of the y:
something like ( pseudocode ):
function find_centroid ( map<Key,Value>input_hist ) returns int y;
Can anybody post a link for such problem solved , such function implemented or description of the algorithm ?
Thanks in advance
댓글 수: 0
답변 (1개)
Doug Hull
2011년 11월 14일
I think I did something kinda similar to this in my book. The code is here.
It was for finding centroids of shapes made by compositing circles, rectangles and triangles.
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!