No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Centroid Calculation Function

3.7 | 14 ratings Rate this file 33 Downloads (last 30 days) File Size: 723 Bytes File ID: #5457 Version: 1.0

Centroid Calculation Function



11 Jul 2004 (Updated )

Calculates centroid of an object present in an image.

| Watch this File

File Information

Function takes a picture as an argument (suitably should contain only one object whose centroid is to be obtained) and returns the x and y coordinates of its centroid.

Required Products Image Processing Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (15)
04 May 2016 Kai Li

Kai Li (view profile)

03 Jun 2012 Mohammad Ali Bagheri

the following code is easier and faster:
X=1:N; Y=1:M;

Besides, you may use "meshgrid" command instead of defining x variable in your code (i.e. x=meshgrid(1:columns,1:rows);)

Comment only
10 Mar 2010 Anton Kylling

Calculates the centroid of the entire image.

21 May 2008 Kameron Rausch

This is a first order centroiding algorithm but is not suitable for determining the centroids of objects when a background in present.

02 Apr 2008 Javeria Malik

thanks fahad this is the first step of my project implementation
Many thanks

18 Mar 2008 Anonimous -

Thanks a lot for this code. It will be very useful for me =)

02 Mar 2008 islam ali

thank you for this code but if there is shadow of object in pic. can this code measure the real C.G of the object

11 Dec 2007 Asma Mughal

it helped me im my Computer Vision Assignment

16 Nov 2007 Steve Jenkins

10 Mar 2007 c koley


08 Dec 2006 saga y

17 Nov 2006 Shirley Hui

Works well.

06 Sep 2006 Lester Chong

Simple to implement. With instructions

06 Oct 2005 shaun truong

10 Aug 2005 Carl Fischer

quick and useful. Save yourself a few minutes of coding.

Contact us