mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-04-30 19:22:03 +02:00
get_marginals(): fixup point_right fallback
This commit is contained in:
parent
68ceeec764
commit
45a43f7e5e
1 changed files with 4 additions and 7 deletions
|
|
@ -113,6 +113,7 @@ def get_marginals(text_mask_d, early_layout, num_col, slope_deskew, kernel=None,
|
|||
else:
|
||||
point_left = peaks_left[np.argmax(scores[peaks_left])]
|
||||
#point_right = last_nonzero
|
||||
point_right = 0
|
||||
|
||||
main_mask_d[:, point_left: point_right] = 1
|
||||
|
||||
|
|
@ -138,8 +139,6 @@ def get_marginals(text_mask_d, early_layout, num_col, slope_deskew, kernel=None,
|
|||
|
||||
# rs: rotate back (into undeskewed/original shape as early_layout input):
|
||||
main_mask = rotate_image(main_mask_d, -slope_deskew)
|
||||
main_mask_y = main_mask.sum(axis=0)
|
||||
main_mask_y_nz = np.flatnonzero(main_mask_y)
|
||||
|
||||
min_area_text = 0.00001
|
||||
main_contour = return_contours_of_interested_region(main_mask, 1, min_area_text)[0]
|
||||
|
|
@ -154,7 +153,7 @@ def get_marginals(text_mask_d, early_layout, num_col, slope_deskew, kernel=None,
|
|||
False):
|
||||
marg_contours.append(contour)
|
||||
|
||||
early_layout_orig = np.copy(early_layout)
|
||||
# early_layout_orig = np.copy(early_layout)
|
||||
early_layout = cv2.fillPoly(early_layout, pts=marg_contours, color=label_marg)
|
||||
|
||||
# plt.figure()
|
||||
|
|
@ -167,8 +166,6 @@ def get_marginals(text_mask_d, early_layout, num_col, slope_deskew, kernel=None,
|
|||
# ax4 = plt.subplot(2, 2, 4, title='early_layout (undeskewed labels split)')
|
||||
# plt.imshow(early_layout)
|
||||
# plt.show()
|
||||
#plt.imshow(early_layout)
|
||||
#plt.show()
|
||||
|
||||
else:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue