#NEWLINE# def _rectify( self , square ) : #NEWLINE# #INDENT# 'Put vertices of square in clockwise order.\n\n        Args:\n            square: List of vertices representing a square.\n\n        Returns:\n            List of vertices of the square in clockwise order.\n        ' #NEWLINE# square = square . reshape ( ( 4 , 2 ) ) #NEWLINE# square_new = np . zeros ( ( 4 , 2 ) , dtype = np . float32 ) #NEWLINE# add = square . sum ( 1 ) #NEWLINE# square_new [ 0 ] = square [ np . argmin ( add ) ] #NEWLINE# square_new [ 2 ] = square_new [ np . argmax ( add ) ] #NEWLINE# diff = np . diff ( square , axis = 1 ) #NEWLINE# square_new [ 1 ] = square [ np . argmin ( diff ) ] #NEWLINE# square_new [ 3 ] = square [ np . argmax ( diff ) ] #NEWLINE# return square_new