sparkocr.utils.craft.file_utils#
Module Contents#
Functions#
|
Creates given directory if it is not present. |
|
|
|
Downloads file from gdrive, shows progress. |
|
|
|
|
|
save text detection result one by one |
|
|
|
|
|
- create_dir(_dir)#
Creates given directory if it is not present.
- crop_poly(image, poly)#
- download(url: str, save_path: str)#
Downloads file from gdrive, shows progress. Example inputs:
url: ‘ftp://smartengines.com/midv-500/dataset/01_alb_id.zip’ save_path: ‘data/file.zip’
- export_detected_region(image, poly, file_path, rectify=True)#
- Parameters:
image – full image
points – bbox or poly points
file_path – path to be exported
rectify – rectify detected polygon by affine transform
- export_detected_regions(image, regions, file_name: str = 'image', output_dir: str = 'output/', rectify: bool = False)#
- Parameters:
image – path to the image to be processed or numpy array or PIL image
regions – list of bboxes or polys
file_name (str) – export image file name
output_dir – folder to be exported
rectify – rectify detected polygon by affine transform
- export_extra_results(image, regions, heatmaps, file_name: str = 'image', output_dir='output/', verticals=None, texts=None)#
save text detection result one by one :param image: path to the image to be processed or numpy array or PIL image :param file_name: export image file name :type file_name: str :param boxes: array of result file
Shape: [num_detections, 4] for BB output / [num_detections, 4] for QUAD output
- Returns:
None
- get_files(img_dir)#
- list_files(in_path)#
- rectify_poly(img, poly)#