Skip to content

Commit

Permalink
updating textline dilation parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
vahidrezanezhad committed Sep 23, 2024
1 parent 62f8ae4 commit 6626dc6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions qurator/eynollah/eynollah.py
Original file line number Diff line number Diff line change
Expand Up @@ -3950,16 +3950,26 @@ def dilate_textline_contours(self,all_found_textline_polygons):
##dilation_m1 = 12
##dilation_m2 = int(dilation_m1/2.) +1

if (y_max-y_min) <= (x_max-x_min) and ((y_max-y_min)/(x_max-x_min))<0.3 and (x_max-x_min)>50:
if (y_max-y_min) <= (x_max-x_min) and ((y_max-y_min)/(x_max-x_min))<0.15 and (x_max-x_min)>50:
dilation_m1 = int( (y_max-y_min) * 5/20.0 )
elif (y_max-y_min) <= (x_max-x_min) and ((y_max-y_min)/(x_max-x_min))>=0.15 and ((y_max-y_min)/(x_max-x_min))<0.3 and (x_max-x_min)>50:
dilation_m1 = int( (y_max-y_min) * 2/20.0 )
elif (y_max-y_min) <= (x_max-x_min) and ((y_max-y_min)/(x_max-x_min))>=0.3 and (x_max-x_min)>50:
dilation_m1 = int( (y_max-y_min) * 1/20.0 )
elif (x_max-x_min) < (y_max-y_min) and ((x_max-x_min)/(y_max-y_min))<0.3 and (y_max-y_min)>50:
elif (x_max-x_min) < (y_max-y_min) and ((x_max-x_min)/(y_max-y_min))<0.15 and (y_max-y_min)>50:
dilation_m1 = int( (x_max-x_min) * 5/20.0 )
elif (x_max-x_min) < (y_max-y_min) and ((x_max-x_min)/(y_max-y_min))>=0.15 and ((x_max-x_min)/(y_max-y_min))<0.3 and (y_max-y_min)>50:
dilation_m1 = int( (x_max-x_min) * 2/20.0 )
elif (x_max-x_min) < (y_max-y_min) and ((x_max-x_min)/(y_max-y_min))>=0.3 and (y_max-y_min)>50:
dilation_m1 = int( (x_max-x_min) * 1/20.0 )
else:
dilation_m1 = int( (y_max-y_min) * 4/20.0 )

if dilation_m1>12:
dilation_m1 = 12
if dilation_m1<4:
dilation_m1 = 4
#print(dilation_m1, 'dilation_m1')
dilation_m2 = int(dilation_m1/2.) +1

for i in range(len(x_differential)):
Expand Down

0 comments on commit 6626dc6

Please sign in to comment.