Pil
PILLoader
Bases: KoshLoader
Source code in kosh/loaders/pil.py
__init__(obj, **kargs)
ImageLoader for Kosh to be able to read in pillow (PIL) compatible image files
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
object
|
Kosh obj reference |
required |
describe_feature(feature)
describe_feature describe the feature as a dictionary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
feature to describe |
required |
Returns:
| Type | Description |
|---|---|
dict
|
dictionary with attributes describing the feature: size, mode, format |
Source code in kosh/loaders/pil.py
extract()
get a feature
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
in this case element/metric |
required |
format
|
str
|
desired output format (numpy only for now) |
required |
Returns:
| Type | Description |
|---|---|
numpy.ndarray | bytes
|
numpy array or raw bytes |
Source code in kosh/loaders/pil.py
list_features()
list_features lists features available
Returns:
| Type | Description |
|---|---|
list
|
list of features you can retrieve ["image", ] in our case |
open(mode='r')
open the pil reader
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
(str, optional)
|
mode to open the file in, defaults to 'r' |
'r'
|
Returns:
| Type | Description |
|---|---|
|
Image file from PIL |