img.WaveletImage
Bases: impl.WaveletImage
A class to load/save images of different formats and store them in WaveletBuffer
Source code in python/src/wavelet_buffer/img/wavelet_image.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
buffer: WaveletBuffer
property
¶
Get wavelet buffer
__init__(signal_shape, signal_number, decomposition_steps, wavelet_type)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal_shape |
List[int]
|
for 1D signal with size N [N], for 2DN signal with size MXN, [M,N] |
required |
signal_number |
int
|
N for 2DN signal, e.g. RGB image would be 3 signals |
required |
decomposition_steps |
int
|
number of decomposition steps |
required |
wavelet_type |
WaveletType
|
type WaveletType.NONE, DB{1..5}, if it is NONE no wavelet composition |
required |
Source code in python/src/wavelet_buffer/img/wavelet_image.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
distance(other)
¶
Distance to other image. 1 - the same, 0 - something completely different
Source code in python/src/wavelet_buffer/img/wavelet_image.py
105 106 107 | |
export_to_file(file_path, codec, start_channel=0)
¶
Encoding a wavelet image to a file with common image format e.g. JPEG
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path |
str
|
path to image |
required |
codec |
BaseCodec
|
a coodec for encoding the image format |
required |
start_channel |
int
|
need if you want to encode specific channel as a monochrome image, or you have a few images in the buffer |
0
|
Source code in python/src/wavelet_buffer/img/wavelet_image.py
47 48 49 50 51 52 53 54 55 56 57 | |
export_to_string(codec, start_channel=0)
¶
Encoding a wavelet image to a byte sting with common image format e.g. JPEG
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
codec |
BaseCodec
|
a coodec for encoding the image format |
required |
start_channel |
int
|
need if you want to encode specific channel as a monochrome image, or you have a few images in the buffer |
0
|
Returns:
| Type | Description |
|---|---|
bytes
|
encoded image e.g. JPEG string |
Source code in python/src/wavelet_buffer/img/wavelet_image.py
77 78 79 80 81 82 83 84 85 86 | |
import_from_file(file_path, denoiser, codec, start_channel=0)
¶
Import an image from file and decompose it with WaveletBuffer
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path |
str
|
path to image |
required |
denoiser |
BaseDenoiser
|
denoising algorithm |
required |
codec |
BaseCodec
|
a coodec for decoding the image format |
required |
start_channel |
int
|
need if you want to decode specific channel as a monochrome image |
0
|
Source code in python/src/wavelet_buffer/img/wavelet_image.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
import_from_string(data, denoiser, codec, start_channel=0)
¶
Import an image from byte sting and decompose it with WaveletBuffer
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data |
bytes
|
encoded image e.g. JPEG string |
required |
denoiser |
BaseDenoiser
|
denoising algorithm |
required |
codec |
BaseCodec
|
a coodec for decoding the image format |
required |
start_channel |
int
|
need if you want to decode specific channel as a monochrome image |
0
|
Source code in python/src/wavelet_buffer/img/wavelet_image.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
load(file_path)
staticmethod
¶
Deserialize a wavelet image from file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path |
str
|
|
required |
Returns:
| Type | Description |
|---|---|
WaveletImage
|
decompressed image |
Source code in python/src/wavelet_buffer/img/wavelet_image.py
88 89 90 91 92 93 94 95 96 | |
save(file_path)
¶
Serialize image to a file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path |
str
|
|
required |
Source code in python/src/wavelet_buffer/img/wavelet_image.py
98 99 100 101 102 103 | |