mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-06-08 11:49:55 +02:00
The rotate_image function produces the exact same rotation as Imutils. Therefore, there is no need to retain the remove-imutils-1 branch.
This commit is contained in:
parent
b55389ac62
commit
cf40f9ecc5
3 changed files with 9 additions and 13 deletions
|
@ -3,6 +3,5 @@ ocrd >= 2.23.3
|
||||||
numpy <1.24.0
|
numpy <1.24.0
|
||||||
scikit-learn >= 0.23.2
|
scikit-learn >= 0.23.2
|
||||||
tensorflow < 2.13
|
tensorflow < 2.13
|
||||||
imutils >= 0.5.3
|
|
||||||
numba <= 0.58.1
|
numba <= 0.58.1
|
||||||
loky
|
loky
|
||||||
|
|
|
@ -4,7 +4,6 @@ import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from shapely import geometry
|
from shapely import geometry
|
||||||
import cv2
|
import cv2
|
||||||
import imutils
|
|
||||||
from scipy.signal import find_peaks
|
from scipy.signal import find_peaks
|
||||||
from scipy.ndimage import gaussian_filter1d
|
from scipy.ndimage import gaussian_filter1d
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import imutils
|
|
||||||
import cv2
|
import cv2
|
||||||
|
|
||||||
def rotatedRectWithMaxArea(w, h, angle):
|
def rotatedRectWithMaxArea(w, h, angle):
|
||||||
|
@ -35,7 +33,7 @@ def rotate_max_area_new(image, rotated, angle):
|
||||||
return rotated[y1:y2, x1:x2]
|
return rotated[y1:y2, x1:x2]
|
||||||
|
|
||||||
def rotation_image_new(img, thetha):
|
def rotation_image_new(img, thetha):
|
||||||
rotated = imutils.rotate(img, thetha)
|
rotated = rotate_image(img, thetha)
|
||||||
return rotate_max_area_new(img, rotated, thetha)
|
return rotate_max_area_new(img, rotated, thetha)
|
||||||
|
|
||||||
def rotate_image(img_patch, slope):
|
def rotate_image(img_patch, slope):
|
||||||
|
@ -62,17 +60,17 @@ def rotate_max_area(image, rotated, rotated_textline, rotated_layout, rotated_ta
|
||||||
return rotated[y1:y2, x1:x2], rotated_textline[y1:y2, x1:x2], rotated_layout[y1:y2, x1:x2], rotated_table_prediction[y1:y2, x1:x2]
|
return rotated[y1:y2, x1:x2], rotated_textline[y1:y2, x1:x2], rotated_layout[y1:y2, x1:x2], rotated_table_prediction[y1:y2, x1:x2]
|
||||||
|
|
||||||
def rotation_not_90_func(img, textline, text_regions_p_1, table_prediction, thetha):
|
def rotation_not_90_func(img, textline, text_regions_p_1, table_prediction, thetha):
|
||||||
rotated = imutils.rotate(img, thetha)
|
rotated = rotate_image(img, thetha)
|
||||||
rotated_textline = imutils.rotate(textline, thetha)
|
rotated_textline = rotate_image(textline, thetha)
|
||||||
rotated_layout = imutils.rotate(text_regions_p_1, thetha)
|
rotated_layout = rotate_image(text_regions_p_1, thetha)
|
||||||
rotated_table_prediction = imutils.rotate(table_prediction, thetha)
|
rotated_table_prediction = rotate_image(table_prediction, thetha)
|
||||||
return rotate_max_area(img, rotated, rotated_textline, rotated_layout, rotated_table_prediction, thetha)
|
return rotate_max_area(img, rotated, rotated_textline, rotated_layout, rotated_table_prediction, thetha)
|
||||||
|
|
||||||
def rotation_not_90_func_full_layout(img, textline, text_regions_p_1, text_regions_p_fully, thetha):
|
def rotation_not_90_func_full_layout(img, textline, text_regions_p_1, text_regions_p_fully, thetha):
|
||||||
rotated = imutils.rotate(img, thetha)
|
rotated = rotate_image(img, thetha)
|
||||||
rotated_textline = imutils.rotate(textline, thetha)
|
rotated_textline = rotate_image(textline, thetha)
|
||||||
rotated_layout = imutils.rotate(text_regions_p_1, thetha)
|
rotated_layout = rotate_image(text_regions_p_1, thetha)
|
||||||
rotated_layout_full = imutils.rotate(text_regions_p_fully, thetha)
|
rotated_layout_full = rotate_image(text_regions_p_fully, thetha)
|
||||||
return rotate_max_area_full_layout(img, rotated, rotated_textline, rotated_layout, rotated_layout_full, thetha)
|
return rotate_max_area_full_layout(img, rotated, rotated_textline, rotated_layout, rotated_layout_full, thetha)
|
||||||
|
|
||||||
def rotate_max_area_full_layout(image, rotated, rotated_textline, rotated_layout, rotated_layout_full, angle):
|
def rotate_max_area_full_layout(image, rotated, rotated_textline, rotated_layout, rotated_layout_full, angle):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue