img.WaveletImage
wavelet_buffer.img.WaveletImage
¶
A class to load/save images of different formats and store them in WaveletBuffer
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 |
distance(other)
¶
Distance to other image. 1 - the same, 0 - something completely different
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
|
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 |
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
|
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
|
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 |
save(file_path)
¶
Serialize image to a file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
required |