Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Matlab to realize iterative adaptive point algorithm

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to use Matlab to achieve iterative adaptation point algorithm," interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how to use Matlab to realize iterative adaptation point algorithm"!

Douglas-Peucker algorithm (also known as Lammer-Douglas-Peucker algorithm, iterative adaptive point algorithm, split and merge algorithm) is an algorithm that approximates a curve to a series of points and reduces the number of points. The advantage of this method is that it has translation and rotation invariance, and the sampling result is definite after given curve and threshold.

1. algorithmic descriptions

1. Connect a line between the two points of the curve and find the distance from the other points to the line.

2. Choose the largest one and compare it with the threshold value. If it is greater than the threshold value, the point with the largest distance from the straight line will be retained, otherwise all the points between the two ends of the straight line will be discarded.

3. According to the reserved points, the known curve is divided into two parts for processing, the first and second operations are repeated, and the iterative operation is repeated, i.e., the maximum distance is still selected and compared with the threshold value, and the selection is made in turn until no point can be discarded, and finally the coordinates of the curve points meeting the given accuracy limit are obtained.

Long Time Later

2. tool functions

For the sake of simplicity and understandability of the code, a binary iteration is used here, with detailed comments as follows (code pieces can slide left and right).

function nPntSet=dp(pntSet,TH)% @author : slanderer % pntSet : 2D data point % TH : Distance threshold % Vector operation: Calculate the distance between all points and the first two points vertV=[pntSet(end,2)-pntSet(1,2),-pntSet(end,1)+pntSet(1,1)];baseL=abs(sum((pntSet-pntSet(1,:)).* vertV./ norm(vertV),2));if max(baseL)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report