Module: | pysteg.jpeg |
---|---|
Date: | $Date: 2010-07-18 20:35:43 +0100 (Sun, 18 Jul 2010) $ |
Revision: | $Revision: 1601 $ |
Copyright: | © 2010: University of Surrey, UK |
Author: | Hans Georg Schaathun <H.Schaathun@surrey.ac.uk> (2010) |
The main purpose of this package is to get direct access to the JPEG data in a compressed file, without decompressing. This functionality is provided by the jpeg class, which is the only member intended for export.
The core functionality is implemented in C, as the jpegObject class, following the pattern of Phil Sallee’s toolbox for Matlab. This class is not intended for direct use. The derived jpeg class gives additional functionality implemented in Python. The jpegObject class should never be used in itself.
The intention is to provide full support for compression and decompression as well, but this has not yet been implemented and tested.
This package is implemented partly in C, and the C code is not properly documented. The main components are:
The jpeg (derived from jpegObject) allows the user to extract a sequence of pseudo-randomly ordered jpeg coefficients for watermarking/steganography, and reinsert them.
Make a histogram of absolute values for a signal.
Coefficient arrays.
JPEG Comments (List of Strings).
Component info (List of Dictionaries).
Filename.
Return the decompressed, calibrated, grayscale image. A different colour channel can be selected with the channel argument.
Return a calibrated coefficient matrix for the given channel. Channel may be “Y”, “Cb”, or “Cr” for YCbCr format. For Grayscale images, it may be None or “Y”.
This method returns the coefficient matrix for the given colour channel (as a matrix).
This method returns one decompressed colour channel as a matrix. The appropriate JPEG coefficient matrix is dequantised (using the quantisation tables held by the object) and inverse DCT transformed.
Return a 1D array of AC coefficients in random order.
Make a histogram of the jpeg coefficients. The mask is a boolean 8x8 matrix indicating the frequencies to be included. This defaults to the AC coefficients.
Color space of the decompressed image
Number of colour components
The height of the image
The width of the image
Color space of the JPEG representation
Number of colour components in the JPEG representation
Number of non-zero AC coefficients.
Arguments are passed to rawsignal(), so a non-default mask could be specified to get other coefficients than the 63 AC coefficients.
Flag to say if the Huffmann tables should be optimized on saving. This should always be 1 (TRUE).
Print the colour space codes used.
Flag to say if Progressive mode should be used.
Quantisation Tables.
Return a 1D array of AC coefficients. (Most applications should use getsignal() rather than rawsignal().)
Save the image back to file. (filename optional)
Reinserts AC coefficients from getitem in the correct positions.