def example4():
transform_matrix = create_transformation_matrix()<EOL>result = tl.prepro.affine_transform_cv2(image, transform_matrix)  <EOL>coords = [[(<NUM_LIT:50>, <NUM_LIT:100>), (<NUM_LIT:100>, <NUM_LIT:100>), (<NUM_LIT:100>, <NUM_LIT:50>), (<NUM_LIT:200>, <NUM_LIT:200>)], [(<NUM_LIT>, <NUM_LIT:50>), (<NUM_LIT:200>, <NUM_LIT:50>), (<NUM_LIT:200>, <NUM_LIT:100>)]]<EOL>coords_result = tl.prepro.affine_transform_keypoints(coords, transform_matrix)<EOL>def imwrite(image, coords_list, name):<EOL><INDENT>coords_list_ = []<EOL>for coords in coords_list:<EOL><INDENT>coords = np.array(coords, np.int32)<EOL>coords = coords.reshape((-<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:2>))<EOL>coords_list_.append(coords)<EOL><DEDENT>image = cv2.polylines(image, coords_list_, True, (<NUM_LIT:0>, <NUM_LIT:255>, <NUM_LIT:255>), <NUM_LIT:3>)<EOL>cv2.imwrite(name, image[..., ::-<NUM_LIT:1>])<EOL><DEDENT>imwrite(image, coords, '<STR_LIT>')<EOL>imwrite(result, coords_result, '<STR_LIT>')<EOL>
Example 4: Transforming coordinates using affine matrix.