从分割后就判断图片是否为空
This commit is contained in:
@@ -92,6 +92,8 @@ def information_extraction(ie, phrecs, identity):
|
|||||||
zx_ie_results = []
|
zx_ie_results = []
|
||||||
split_results = image_util.split(dewarped_image)
|
split_results = image_util.split(dewarped_image)
|
||||||
for split_result in split_results:
|
for split_result in split_results:
|
||||||
|
if split_result["img"] is None or split_result["img"].size == 0:
|
||||||
|
continue
|
||||||
rotated_img = image_util.rotate(split_result["img"], int(angles[0]))
|
rotated_img = image_util.rotate(split_result["img"], int(angles[0]))
|
||||||
ie_results = [{"result": ie_temp_image(ie, OCR, rotated_img), "angle": angles[0]}]
|
ie_results = [{"result": ie_temp_image(ie, OCR, rotated_img), "angle": angles[0]}]
|
||||||
if not ie_results[0]["result"] or len(ie_results[0]["result"]) < len(ie.kwargs.get("schema")):
|
if not ie_results[0]["result"] or len(ie_results[0]["result"]) < len(ie.kwargs.get("schema")):
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ def rotate(image, angle):
|
|||||||
:param angle: 逆时针旋转角度
|
:param angle: 逆时针旋转角度
|
||||||
:return: 旋转后的图片NumPy数组
|
:return: 旋转后的图片NumPy数组
|
||||||
"""
|
"""
|
||||||
if angle == 0 or image is None or image.size == 0:
|
if angle == 0:
|
||||||
return image
|
return image
|
||||||
height, width = image.shape[:2]
|
height, width = image.shape[:2]
|
||||||
if angle == 180:
|
if angle == 180:
|
||||||
|
|||||||
Reference in New Issue
Block a user