mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-06-09 20:29:55 +02:00
more extraction of util functions
This commit is contained in:
parent
890e2a6988
commit
aa76a223df
2 changed files with 14 additions and 13 deletions
|
@ -76,6 +76,7 @@ from .utils import (
|
|||
seperate_lines_new_inside_teils2,
|
||||
seperate_lines_vertical_cont,
|
||||
delete_seperator_around,
|
||||
return_regions_without_seperators,
|
||||
)
|
||||
|
||||
|
||||
|
@ -3827,18 +3828,6 @@ class eynollah:
|
|||
# cv2.imwrite(os.path.join(dir_of_image, self.f_name) + ".tif",self.image_org)
|
||||
|
||||
|
||||
def return_regions_without_seperators(self, regions_pre):
|
||||
kernel = np.ones((5, 5), np.uint8)
|
||||
regions_without_seperators = ((regions_pre[:, :] != 6) & (regions_pre[:, :] != 0)) * 1
|
||||
# regions_without_seperators=( (image_regions_eraly_p[:,:,:]!=6) & (image_regions_eraly_p[:,:,:]!=0) & (image_regions_eraly_p[:,:,:]!=5) & (image_regions_eraly_p[:,:,:]!=8) & (image_regions_eraly_p[:,:,:]!=7))*1
|
||||
|
||||
regions_without_seperators = regions_without_seperators.astype(np.uint8)
|
||||
|
||||
regions_without_seperators = cv2.erode(regions_without_seperators, kernel, iterations=6)
|
||||
|
||||
return regions_without_seperators
|
||||
|
||||
|
||||
def image_change_background_pixels_to_zero(self, image_page):
|
||||
image_back_zero = np.zeros((image_page.shape[0], image_page.shape[1]))
|
||||
image_back_zero[:, :] = image_page[:, :, 0]
|
||||
|
@ -6048,7 +6037,7 @@ class eynollah:
|
|||
|
||||
args_big_parts = np.array(range(len(spliter_y_new_diff)))[spliter_y_new_diff > 22]
|
||||
|
||||
regions_without_seperators = self.return_regions_without_seperators(region_pre_p)
|
||||
regions_without_seperators = return_regions_without_seperators(region_pre_p)
|
||||
|
||||
##print(args_big_parts,'args_big_parts')
|
||||
# image_page_otsu=otsu_copy(image_page_deskewd)
|
||||
|
|
|
@ -2329,3 +2329,15 @@ def delete_seperator_around(spliter_y, peaks_neg, image_by_region):
|
|||
image_by_region[int(spliter_y[i]) : int(spliter_y[i + 1]), peaks_neg[i][j] - int(1.0 / 20.0 * peaks_neg[i][j]) : peaks_neg[i][j] + int(1.0 / 20.0 * peaks_neg[i][j])][image_by_region[int(spliter_y[i]) : int(spliter_y[i + 1]), peaks_neg[i][j] - int(1.0 / 20.0 * peaks_neg[i][j]) : peaks_neg[i][j] + int(1.0 / 20.0 * peaks_neg[i][j])] == 7] = 0
|
||||
return image_by_region
|
||||
|
||||
def return_regions_without_seperators(regions_pre):
|
||||
kernel = np.ones((5, 5), np.uint8)
|
||||
regions_without_seperators = ((regions_pre[:, :] != 6) & (regions_pre[:, :] != 0)) * 1
|
||||
# regions_without_seperators=( (image_regions_eraly_p[:,:,:]!=6) & (image_regions_eraly_p[:,:,:]!=0) & (image_regions_eraly_p[:,:,:]!=5) & (image_regions_eraly_p[:,:,:]!=8) & (image_regions_eraly_p[:,:,:]!=7))*1
|
||||
|
||||
regions_without_seperators = regions_without_seperators.astype(np.uint8)
|
||||
|
||||
regions_without_seperators = cv2.erode(regions_without_seperators, kernel, iterations=6)
|
||||
|
||||
return regions_without_seperators
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue