Make apple vision and easy ocr faster
This commit is contained in:
@@ -263,7 +263,7 @@ class AppleVision:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_bytes = io.BytesIO()
|
image_bytes = io.BytesIO()
|
||||||
img.save(image_bytes, format='png')
|
img.save(image_bytes, format='bmp')
|
||||||
return image_bytes.getvalue()
|
return image_bytes.getvalue()
|
||||||
|
|
||||||
class WinRTOCR:
|
class WinRTOCR:
|
||||||
@@ -321,7 +321,7 @@ class WinRTOCR:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_bytes = io.BytesIO()
|
image_bytes = io.BytesIO()
|
||||||
img.save(image_bytes, format='png')
|
img.save(image_bytes, format='png', compress_level=1)
|
||||||
return image_bytes.getvalue()
|
return image_bytes.getvalue()
|
||||||
|
|
||||||
class AzureComputerVision:
|
class AzureComputerVision:
|
||||||
@@ -418,9 +418,7 @@ class EasyOCR:
|
|||||||
return x
|
return x
|
||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_bytes = io.BytesIO()
|
return np.array(img.convert('RGB'))
|
||||||
img.save(image_bytes, format='png')
|
|
||||||
return image_bytes.getvalue()
|
|
||||||
|
|
||||||
class RapidOCR:
|
class RapidOCR:
|
||||||
name = 'rapidocr'
|
name = 'rapidocr'
|
||||||
@@ -466,4 +464,3 @@ class RapidOCR:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
return np.array(img.convert('RGB'))
|
return np.array(img.convert('RGB'))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user