I have a n:2 Matrix with points(x,y) found from dots in a rectangular calibration pattern.
I like to sort these points row by row.
I have sorted these points with lexsort but the distortion from the camera is too big so that y-coordinates will be overlap.

Can you count on the x-coordinates not overlapping? You could invert your sorting order and then transpose the resulting matrix. That would make life much, much easier. The Delaunay triangulation may be more robust to small overlaps, but if the distortion is too large, it will also break down the rectangular pattern.
–
JaimeDec 18 '12 at 17:04

Why would you want to sort them? The point of calibrating is that you can 'just' put a large number of point in the algorithms. After calibrating, you can restore the image and the points will be exactly on lines.
–
RobAuDec 20 '12 at 8:14