#NEWLINE# def build_centering_transform( image_shape , target_shape = ( 50 , 50 ) ) : #NEWLINE# #INDENT# ( rows , cols ) = target_shape #NEWLINE# ( trows , tcols ) = target_shape #NEWLINE# shift_x = ( ( cols - tcols ) / 2.0 ) #NEWLINE# shift_y = ( ( rows - trows ) / 2.0 ) #NEWLINE# return skimage . transform . SimilarityTransform ( translation = ( shift_x , shift_y ) )