FUNCTION cow,lit,lpo,sx,xcw,ycw ;SUBROUTINE FOR OTRACK3 ;Computes a 1-D representation of the CENTER-OF-WEIGHT position ;of an object characterized by the list of pixel intensities LIT ;and the list of 1-D pixel positions LPO. SX is the x-size of the ;image (to convert 1-D coords to 2-D and back). LIT,LPO,SX are ;integer numbers. Called subroutine NINT (FIX(ROUND()) can be used ;instead). 11.6.1998, Michal ; ;Example: CWPOS=COW(IMA(LPO),LPO,SX) (integer) x=lpo mod sx ;coords conversion to 2-D y=lpo/sx tli=total(lit) ;center-of-gravity calculation xcw=nint(total(lit*x)/tli) ycw=nint(total(lit*y)/tli) cw=ycw*sx+xcw ;coords conversion to 1-D RETURN,cw end