Skip to main content

Image compression and decompression tool using SVD

Project description

SVD image compression and decompression tool

Installation

Install CLI using pipx:

pipx install git+https://github.com/toadharvard/svdi-cli.git

Or

pipx install svdi-cli

Usage example

svdi compress --in-file=images/rafiq.bmp --out-file=images/liquidated.svdi --compression=3 --method=numpy

svdi decompress --in-file=images/liquidated.svdi --out-file=images/rafiq2.bmp

ls -l ./images

Available SVD functions

  1. rsvd — N Halko, P. G Martinsson, and J. A Tropp. Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions. Siam Review, 53(2):217-288, 2011.
  2. numpy — NumPy's np.linalg.svd function.
  3. pcafast — H. Li, G. C. Linderman, A. Szlam, K. P. Stanton, Y. Kluger, and M. Tygert. Algorithm 971: An implementation of a randomized algorithm for principal component analysis. Acm Transactions on Mathematical Software, 43(3):1-14, 2017.
  4. pi — Power iterations method. URL: http://www.cs.yale.edu/homes/el327/datamining2013aFiles/07_singular_value_decomposition.pdf

Available commands

svdi --help
svdi compress --help
svdi decompress --help

SVDI Format

The CLI uses a simple binary format for storing SVD results in .svdi files.

Each .svdi file consists of a header followed by the SVD results for each channel:

  1. Header
    1. Signature: A fixed 4-byte sequence b'SVDI' to identify the file format.
    2. Dimensions: Three 4-byte unsigned integers representing the shape of the matrices: m, n, and k.
      • m: The number of rows in each U matrix.
      • n: The number of columns in each Vh matrix.
      • k: The size of each S vector, and the number of columns in U and rows in Vh.
  2. Channel Data Repeated for each channel (NUMBER_OF_CHANNELS):
    • U Matrix: A matrix of size m * k, with elements stored as 32-bit floats in row-major order.
    • S Vector: A vector of length k, with elements stored as 32-bit floats.
    • Vh Matrix: A matrix of size k * n, with elements stored as 32-bit floats in row-major order.

Licence

See the details of the license in the LICENCE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svdi-1.0.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

svdi-1.0.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file svdi-1.0.0.tar.gz.

File metadata

  • Download URL: svdi-1.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for svdi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5a3511c38294edf3099372da74b9b3ae2097cdb9c6ff61164426dff0b7df80cc
MD5 a72102a54ae65e8cbdc01e445b53f8ff
BLAKE2b-256 94fbd9a14d139d9d773021d8b08fc09056b1e4ffe44755efe95941bc2f080f9a

See more details on using hashes here.

File details

Details for the file svdi-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: svdi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for svdi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eee38a05bf5f5530f24e3c45a943ad9794a40603205373445ebacb33273d6f06
MD5 f3ac3c5f2d04613844a3f15d2d18a4e0
BLAKE2b-256 4a6e7ad879d498b30bebfd1b2bcf04914e10815276302a0cce51dca646bc1e78

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page