diff --git a/search.py b/search.py index da484dd..1b56faa 100644 --- a/search.py +++ b/search.py @@ -311,9 +311,6 @@ if __name__ == "__main__": cv2.rectangle(sub_im2, (p['x'], p['y']), (p['x'] + p['width'], p['y'] + p['height']), (0, 0, 255), 2) # 写编号 cv2.putText(sub_im2, str(i), (p['x'], p['y']), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2) - if (i == 15): - print("=========15=======") - print(p) cv2.imshow("sub_im_before_filter", sub_im2) # 过滤点 cnts = filter_points("data_sub/test_1/wide_image.png",cnts) @@ -520,8 +517,5 @@ if __name__ == "__main__": cv2.rectangle(sub_im, (p['x'], p['y']), (p['x']+p['width'],p['y']+p['height']), (0, 0, 255), 2) # 写编号 cv2.putText(sub_im, str(i), (p['x'], p['y']), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2) - if(i == 15): - print("=========15=======") - print(p) cv2.imshow("sub_im_after_filter", sub_im) cv2.waitKey(0) \ No newline at end of file diff --git a/utils.py b/utils.py index 002b928..a833601 100644 --- a/utils.py +++ b/utils.py @@ -16,9 +16,7 @@ def filter_points(image_path,points): image_height = image.shape[0] image_width = image.shape[1] image_x_min = image_width * left_x_cut_rate - print(f"image_x_min====={image_x_min}") image_x_max = image_width * (1 - right_x_cut_rate) - print(f"image_x_max====={image_x_max}") #开始过滤点 bad_point_index = [] @@ -44,13 +42,13 @@ def filter_points(image_path,points): if x_max > image_x_max: bad_point_index.append(index) continue - print(f'过滤点结束,过滤之后的点数为{len(points)}') # 删除bad_point_index filtered_points = [] for i, point in enumerate(points): if i not in bad_point_index: filtered_points.append(point) + print(f'过滤点结束,过滤之后的点数为{len(filtered_points)}') return filtered_points