Thanks. I tried your solution and it works but the side effect is there is obvious image distortion. I think it is because the algorithm is too simple. Is there algorithm to reduce the number of data points at the same time with less image distortion?