View License

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

» Watch video

Highlights from
Line Simplification

4.9 | 9 ratings Rate this file 43 Downloads (last 30 days) File Size: 6.03 KB File ID: #21132 Version: 1.4
image thumbnail

Line Simplification



19 Aug 2008 (Updated )

Recursive Douglas-Peucker Polyline Simplification (Iterative Endpoint Fit)

| Watch this File

File Information

dpsimplify uses the recursive Douglas-Peucker line simplification algorithm to reduce the number of vertices in a polyline according to a specified tolerance. The algorithm is also know as Iterative Endpoint Fit algorithm. dpsimplify can handle polylines and polygones in 2d and higher dimensions.

The submission now contains another m-file (dpsimplify_octave.m) that has been slightly modified to run with GNU Octave.


[ps,ix] = dpsimplify(p,tol)

where p is a nxm matrix that contains n vertices in m dimensions.
For additional information on the algorithm follow this link


This file inspired Grid2tri Gridded Surface To Irregular Triangulation and Region Growing (2 D/3 D Grayscale).

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (21)
05 Jan 2017 Elena Provaggi

11 Nov 2016 Mircea Stoica

11 Apr 2016 Wolfgang Schwanghart

@Mehdi: Thanks for your input. This algorithm assumes all data to be valid, thus there is no treatment of outliers.

Comment only
10 Apr 2016 Mehdi

Mehdi (view profile)

Thanks for sharing
test this data

Do you have any idea for tackling outliers(last point in this data)?

05 Feb 2016 Zhouxin Xi

17 Dec 2015 Alessandro Masullo

02 Dec 2015 ykremer Kremer

Works great, thank you!

Comment only
02 Dec 2015 ykremer Kremer

25 Jun 2012 Antony37

Hi Wolfgang,
Thank you..:)


Comment only
25 Jun 2012 Wolfgang Schwanghart

@Antony37: Simplifyrec basically does one step shown here
It is called recursively so that the entire sequence shown in the picture is computed.

Comment only
25 Jun 2012 Antony37

Hi Wolfgang,
Can you explain the logic under the function 'simplifyrec'?

Comment only
29 Sep 2011 Mate

Mate (view profile)

05 Sep 2011 Daniel

Daniel (view profile)

19 Jan 2011 Brandon

29 Oct 2010 AndreasChr Christ

Hi Wolfgang,
thanks for your answer. Iwill try it

Comment only
25 Oct 2010 Wolfgang Schwanghart

Hi Andreas,

unfortunately I do not have access to the mapping toolbox, so I cannot tell if the results will be the same for dpsimplify and reducem. In general, however, I think, you can replace reducem with this function.

Best regards,

Comment only
20 Oct 2010 AndreasChr Christ

Hi Wolfgang,
I have got cell tracking algorithm for microcopy images as m-files.
Unfortunately this uses MathLabs function "reducem". But we don't have the maps toolbox this function belongs to. Do you have experience if your dpsimplify could repolace reducem?

Comment only
30 Mar 2010 Alistair Templeton

Hi Wolfgang,
I wanted to simplify a contour as exported from a piece of imaging software which was way oversampled. Your program completely plugged and played, perfect!


Comment only
21 Aug 2008 Wolfgang Schwanghart

The file has been updated so that the function can handle polylines, where the first and last vertex have the same coordinates. Just wait a short time until the updated version from 22. August appears.

Comment only
21 Aug 2008 Wolfgang Schwanghart

Hi Gwen,

you are right. I'll fix that as soon as possible.


Comment only
20 Aug 2008 Gwendolyn Fisch


the implementation fails if start and end point of the given line are the same.


Comment only
22 Aug 2008

algorithm works also for polygons (start and end point of the polyline are the same).

10 Jan 2009 1.1

only minor changes: added some comments and changed the link to more information since it was dead.

15 Jun 2009 1.2

Removed a bug in calculating the second output argument. Improved handling of lines with only one segment.

14 Jun 2010 1.3

Added some information in the description.

13 Jul 2010 1.4

added m-file that runs with GNU Octave

Contact us