jpegdna.transforms package¶
Module contents¶
Transforms collection useful for jpegdna
- class jpegdna.transforms.AbstractTransform[source]¶
Bases:
abc.ABC
Abstract class for codec definition
- abstract forward(inp)[source]¶
Forward transform method
- Parameters
inp – Input to transform
- Type
any
- Returns
Transformed message
- Return type
any
- full_forward(inp, *args)[source]¶
Forward transform method
- Parameters
inp – Input to transform
args (any) – Supplementary arguments for the forward transforms
- Type
any
- Returns
Transformed message
- Return type
any
- full_inverse(inp, *args)[source]¶
Inverse transform wrapper method
- Parameters
inp – Input to apply inverse transform
args (any) – Supplementary arguments for the inverse transforms
- Type
any
- Returns
Inverse transformed message
- Return type
any
- get_state(case=None)[source]¶
Helper method to get the state of the codec if necessary
- Return type
any
jpegdna.transforms.colortransform module¶
YCbCr converter for RGB management
- class jpegdna.transforms.colortransform.RGBYCbCr[source]¶
Bases:
jpegdna.transforms.AbstractTransform
RGB YCbCr color converter
jpegdna.transforms.dctransform module¶
Discrete cosine forward and inverse transforms
- class jpegdna.transforms.dctransform.DCT[source]¶
Bases:
jpegdna.transforms.AbstractTransform
For Jpeg
- forward(inp)[source]¶
Forward 2D DCT
- Parameters
inp (np.array) – input image block
- Returns
DCT coefficients
- Return type
np.array
- full_forward(inp, *args)[source]¶
Forward 2D DCT
- Parameters
inp (np.array) – input image block
norm (str) – Type of DCT (default: None)
- Returns
DCT coefficients
- Return type
np.array
jpegdna.transforms.sampler module¶
Sampler class for 3-channels management
- class jpegdna.transforms.sampler.ChannelSampler(sampler='4:2:2')[source]¶
Bases:
jpegdna.transforms.AbstractTransform
Channel Sampler
- Variables
sampler – Sampler name (default: “4:2:2”)
- Parameters
sampler – str
- forward(inp)[source]¶
Sampling method
- Parameters
inp (np.array) – 3-channel image
- Returns
Tuple of the 3 sampled channels (Y not subsampled usually)
- Return type
tuple
jpegdna.transforms.zigzag module¶
Zigzag algorithm
- class jpegdna.transforms.zigzag.ZigZag(verbose=False)[source]¶
Bases:
jpegdna.transforms.AbstractTransform
Zig-zag transform
- Variables
verbose – Verbosity enabler
vmax (int) – width of the matrix
hmax (int) – height of the matrix
- Parameters
verbose – bool
- forward(inp)[source]¶
Transform the inp matrix into a sequence element following the zig-zag reading order
- Parameters
inp (np.array) – Input to be transformed
- Returns
Zig-zag read sequence
- Return type
np.array
- full_inverse(inp, *args)[source]¶
Inverse transform wrapper method
- Parameters
inp – Input to apply inverse transform
args (any) – Supplementary arguments for the inverse transforms
- Type
any
- Returns
Inverse transformed message
- Return type
any