f2, serrations_curvatures=serrations_curvatures, boundary_curvature=boundary_curvature, filename=name2) sheet2 = f2.add_sheet(name2, cell_overwrite_ok=True) for i in range(len(serrations_curvatures)): sheet2.write(0, i, 'serrations_' + str(i + 1) + '_curvature') sheet2.write(0, len(serrations_curvatures), 'boundary_curvature') for i in range(len(serrations_curvatures)): for j in range(1, len(serrations_curvatures[i]) + 1): sheet2.write(j, i, serrations_curvatures[i][j - 1]) for i in range(1, len(boundary_curvature) + 1): sheet2.write(i, len(serrations_curvatures), boundary_curvature[i - 1]) get_leave_serration.show_leave_serration(contours, ser4_idx, ser4_deepest_idx) plt.figure(figsize=(6, 8)) print('getting leaf width height ...') # get leaf width height and rotating angle p1_t, p2_b, k1, k2 = get_leave_top_bottom.get_leave_top_bottom( img, contours) p3_c, p4_r, p5_l = get_leave_top_bottom.search_points(p1_t, p2_b, k2, contours, search_heng=True) p6_c, p7_r, p8_l = get_leave_top_bottom.search_points(p1_t, p3_c, k2, contours,
filename=name1) # 442_100_serration_details.xls save_in_csv_and_text.save_in_serration_details( A4_name, f2, serrations_curvatures=serrations_curvatures, boundary_curvature=boundary_curvature, filename=name2) image = cv2.imread(img, 0) rows, cols = image.shape axes1[i, j].axis([0, rows + 100, cols + 100, 0]) axes2[i, j].axis([0, rows + 100, cols + 100, 0]) get_leave_serration.show_leave_serration(axes1[i, j], contours, ser4_idx, ser4_deepest_idx) print('getting leaf width height ...') # get leaf width height and rotating angle p1_t, p2_b, k1, k2 = get_leave_top_bottom.get_leave_top_bottom( img, contours) p3_c, p4_r, p5_l = get_leave_top_bottom.search_points(p1_t, p2_b, k2, contours, search_heng=True) p6_c, p7_r, p8_l = get_leave_top_bottom.search_points(p1_t, p3_c, k2, contours, search_heng=True)