6. The method of claim 5 , wherein in step (i4), the second down-sampling ratio is equal to the second average horizontal distance.
5. The method of claim 4 , further comprising, before step (e), calculating the second down-sampling ratio, which comprises: (i1) detecting connected regions in the line segment obtained in step (d); (i2) calculating a horizontal distance between each pair of horizontally adjacent connected regions obtained in step (i1); (i3) calculating a second average horizontal distance which is an average of all horizontal distances calculated in step (i2); and (i4) setting the second down-sampling ratio based on the second average horizontal distance calculated in step (i3).