from utils import * def mainColumnsOnly(plan_path, segmented_img, img_cv2): pdf_document = fitz.open(plan_path) page = pdf_document[0] rotation = page.rotation derotationMatrix=page.derotation_matrix outsu = threshold(segmented_img) column_points, mask_clmns, mask_walls = get_columns_info(outsu, img_cv2) texts_from_pdf = get_text_from_pdf(plan_path) text_points, txtpts_ky_vlu = getTextsPoints(texts_from_pdf) if rotation != 0: if rotation == 90: text_points = fix_rotation_90(text_points, derotationMatrix) txtpts_ky_vlu = fix_90_ky_val(txtpts_ky_vlu, derotationMatrix) key_colors = color_groups(txtpts_ky_vlu) nearby, slct_clms, txt_clmn = getNearestText(text_points, column_points) columns_types_v = getColumnsTypesKeyValue(nearby, txtpts_ky_vlu) legend = generate_legend(columns_types_v) huge_list_clmn_clr_loc = get_drawing_info(txt_clmn, txtpts_ky_vlu, key_colors) column_midpoints, wall_midpoints, mask_clmns, mask_walls, wall_contours, all_points, midpoint_full_contour= get_columns_info2(outsu, img_cv2) wall_points = get_all_wall_points(wall_contours) wall_text = get_text_wall_text(plan_path) _,slct_walls, txt_wall = assign_walls_to_texts(text_points, all_points, 90) all_walls = [] for wll in slct_walls: all_walls.append(midpoint_full_contour[wll]) selected_wall_contours = get_all_wall_points(all_walls) return legend, huge_list_clmn_clr_loc, selected_wall_contours