MCPcopy Create free account
hub / github.com/mindee/doctr / from_images

Method from_images

doctr/io/reader.py:63–79  ·  view source on GitHub ↗

Read an image file (or a collection of image files) and convert it into an image in numpy format >>> from doctr.io import DocumentFile >>> pages = DocumentFile.from_images(["path/to/your/page1.png", "path/to/your/page2.png"]) Args: files: the path to the image f

(cls, files: Sequence[AbstractFile] | AbstractFile, **kwargs)

Source from the content-addressed store, hash-verified

61
62 @classmethod
63 def from_images(cls, files: Sequence[AbstractFile] | AbstractFile, **kwargs) -> list[np.ndarray]:
64 """Read an image file (or a collection of image files) and convert it into an image in numpy format
65
66 >>> from doctr.io import DocumentFile
67 >>> pages = DocumentFile.from_images(["path/to/your/page1.png", "path/to/your/page2.png"])
68
69 Args:
70 files: the path to the image file or a binary stream, or a collection of those
71 **kwargs: additional parameters to :meth:`doctr.io.image.read_img_as_numpy`
72
73 Returns:
74 the list of pages decoded as numpy ndarray of shape H x W x 3
75 """
76 if isinstance(files, (str, Path, bytes)):
77 files = [files]
78
79 return [read_img_as_numpy(file, **kwargs) for file in files]

Callers 11

mainFunction · 0.80
_process_fileFunction · 0.80
test_artefact_detectorFunction · 0.80
test_document_fileFunction · 0.80
get_documentsFunction · 0.80
mainFunction · 0.80

Calls 1

read_img_as_numpyFunction · 0.85

Tested by 7

test_artefact_detectorFunction · 0.64
test_document_fileFunction · 0.64