Image processing - Zhang-Suen Thinning

Introduction The next step is to implement the thinning algorithm, where we use the zhang-suen thinning algorithm. This method aims to remove all the points until becoming a single line (skeleton). The algoritmh check all colored points (will call black), then see if the neighbor’s black and white is under some condition, if the condition mets the black point would be removed (that is become white). Implementation CountNonZero8 (result as A) count how many 1’s in the 8 neighbors. Transitions01 (results as B) count how many 0 to 1 for 8 neighbors. Two pass checking (slightly differnet) A should be 2~6 B should be 1 p2 or p4 or p6 should be 0 (p2, p4, p8 in second pass) p4 or p6 or p8 should be 0 (p2, p6, p8 in second pass) denoting as: ...

July 29, 2026 · 2 min

Image processing - Chaikin Smoothing

Introduction Follow by the RDP algorithm, we imeplemtat hte chakin smoothhing algorithm. Rhe algorithm tries to smooth the curve by adding new points witin each segmetns: For the following example, we can see that we try to split each edge into 3 segements (that is insert 2 points as the red dots), and then tried to connect them. Implementation This function is simple nad the input are a list of points and iteration number. Notice that in each iteration, the number of points would become doubled! ...

April 10, 2026 · 1 min

Image processing - RDP algorithm

Introduction Recently I am working on a small to process hand written curve and come up with the RDP algorithm, which stands for Ramer–Douglas–Peucker algorithm. This is the iterative method to simpify the curve by recursively calculateing the distance between the curve, and leave the points that are far away from the curve, and this alogrith ends when the there are no points left. The input is a vector of points, and each step we search for all the points distance, and find hte maximum distance one, and then we recursively call the function for two sides. ...

March 20, 2026 · 3 min