Code covered by the BSD License  

Highlights from
Center of Mass

5.0

5.0 | 2 ratings Rate this file 85 Downloads (last 30 days) File Size: 1.92 KB File ID: #41675

Center of Mass

by

 

CENTEROFMASS finds the center of mass of the N-dimensional input array

| Watch this File

File Information
Description

    centerOfMass(A) finds the gray-level-weighted center of mass of the
    N-dimensional numerical array A. A must be real and finite. A warning
    is issued if A contains any negative values. Any NaN elements of A will
    automatically be ignored. centerOfMass produces center of mass
    coordinates in units of pixels. An empty array is returned if the
    center of mass is undefined.
 
    The center of mass is reported under the assumption that the first
    pixel in each array dimension is centered at 1.
 
    Also note that numerical arrays other than DOUBLE and SINGLE are
    converted to SINGLE in order to prevent numerical roundoff error.
 
    Examples:
        A = rgb2gray(imread('saturn.png'));
        C = centerOfMass(A);
 
        figure; imagesc(A); colormap gray; axis image
        hold on; plot(C(2),C(1),'rx')

Required Products MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
23 May 2014 Kahye  
19 Jan 2014 Lena Veis

You save me a lot of time...
Thank you very much :)

Contact us