Skip to content
RedFantom edited this page Apr 22, 2017 · 1 revision

This project uses its own class to handle image files, specifically the ImageFile class in the files.py file. You can create an ImageFile object really easily, and the class will automatically attempt to read grounding data if it is available for the file.

Creation

from files import ImageFile

path = "path/to/awesome/image.ext"
imagefile = ImageFile(path)

That's it. The image is now read into the object, and you can now ground it or perform OCR on it. You can also place your images in the data folder, as the code will also accept relative paths to that folder. If you do not provide an extension for your image file, the extensions .png, .tif, .jpg and .jpeg will automatically be appended to the name in an attempt to still open the file you specified. If the path you provided is not correct, an Exception will be raised.

Grounding data

The grounding data is stored in .box files with the same name as the image itself, in the same folder. If you want an example of the contents of such a file, you can take a look at the .box files in the data folder found in this repository. Normally, you do not have to interact with these files yourself, the class will manage them for you.

Clone this wiki locally