img.codecs
Interface for codes to decode/encode images from/to different image formats
Source code in python/src/wavelet_buffer/img/codecs.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
channel_number()
¶
Return number ofr channel RGB=3, Gray=1
Source code in python/src/wavelet_buffer/img/codecs.py
27 28 29 | |
decode(blob)
¶
Decode an image from bytes to a numpy image
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blob |
bytes
|
serialized image e.g. JPEG |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray[np.float32]
|
image as numpy array |
Source code in python/src/wavelet_buffer/img/codecs.py
8 9 10 11 12 13 14 15 | |
encode(data, start_channel=0)
¶
Encode a numpy image to byte string
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data |
np.ndarray[np.float32]
|
numpy image |
required |
start_channel |
int
|
start channel for conversion |
0
|
Returns:
| Type | Description |
|---|---|
bytes
|
serialized image e.g. JPEG |
Source code in python/src/wavelet_buffer/img/codecs.py
17 18 19 20 21 22 23 24 25 | |
Bases: BaseCodec
Codec for JPEG <-> numpy RGB image conversion
Source code in python/src/wavelet_buffer/img/codecs.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
__init__(write_quality=1.0)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
write_quality |
float
|
quality of encoded image. Should be from 0 to 1.0 |
1.0
|
Source code in python/src/wavelet_buffer/img/codecs.py
35 36 37 38 39 40 | |
Bases: BaseCodec
Codec for JPEG <-> numpy HSL image conversion
Source code in python/src/wavelet_buffer/img/codecs.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
__init__(write_quality=1.0)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
write_quality |
float
|
quality of encoded image. Should be from 0 to 1.0 |
1.0
|
Source code in python/src/wavelet_buffer/img/codecs.py
55 56 57 58 59 60 | |
Bases: BaseCodec
Codec for JPEG <-> numpy monochrome image conversion
Source code in python/src/wavelet_buffer/img/codecs.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
__init__(write_quality=1.0)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
write_quality |
float
|
quality of encoded image. Should be from 0 to 1.0 |
1.0
|
Source code in python/src/wavelet_buffer/img/codecs.py
75 76 77 78 79 80 | |