mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-12-01 08:44:13 +01:00
combine_hor_lines_and_delete_cross_points: get external contours
instead of tree without looking at the actual hierarchy (to prevent retrieving holes as separators)
This commit is contained in:
parent
ee59a6809d
commit
38d91673b1
1 changed files with 2 additions and 2 deletions
|
|
@ -1180,7 +1180,7 @@ def combine_hor_lines_and_delete_cross_points_and_get_lines_features_back_new(
|
||||||
|
|
||||||
#img_p_in_ver = cv2.erode(img_p_in_ver, self.kernel, iterations=2)
|
#img_p_in_ver = cv2.erode(img_p_in_ver, self.kernel, iterations=2)
|
||||||
_, thresh = cv2.threshold(img_p_in_ver, 0, 255, 0)
|
_, thresh = cv2.threshold(img_p_in_ver, 0, 255, 0)
|
||||||
contours_lines_ver, _ = cv2.findContours(thresh.astype(np.uint8), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
contours_lines_ver, _ = cv2.findContours(thresh.astype(np.uint8), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
||||||
slope_lines_ver, _, x_min_main_ver, _, _, _, y_min_main_ver, y_max_main_ver, cx_main_ver = \
|
slope_lines_ver, _, x_min_main_ver, _, _, _, y_min_main_ver, y_max_main_ver, cx_main_ver = \
|
||||||
find_features_of_lines(contours_lines_ver)
|
find_features_of_lines(contours_lines_ver)
|
||||||
for i in range(len(x_min_main_ver)):
|
for i in range(len(x_min_main_ver)):
|
||||||
|
|
@ -1194,7 +1194,7 @@ def combine_hor_lines_and_delete_cross_points_and_get_lines_features_back_new(
|
||||||
int(cx_main_ver[i])+25] = 0
|
int(cx_main_ver[i])+25] = 0
|
||||||
|
|
||||||
_, thresh = cv2.threshold(img_in_hor, 0, 255, 0)
|
_, thresh = cv2.threshold(img_in_hor, 0, 255, 0)
|
||||||
contours_lines_hor, _ = cv2.findContours(thresh.astype(np.uint8), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
contours_lines_hor, _ = cv2.findContours(thresh.astype(np.uint8), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
||||||
|
|
||||||
slope_lines_hor, dist_x_hor, x_min_main_hor, x_max_main_hor, cy_main_hor, _, _, _, _ = \
|
slope_lines_hor, dist_x_hor, x_min_main_hor, x_max_main_hor, cy_main_hor, _, _, _, _ = \
|
||||||
find_features_of_lines(contours_lines_hor)
|
find_features_of_lines(contours_lines_hor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue