CCSDS 123.0-B Lossless Multispectral and Hyperspectral Image Compression
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 92.6%
Dune 2.1%
Other 5.3%
16 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-hcomp https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-hcomp
git@git.recoil.org:gazagnaire.org/ocaml-hcomp git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-hcomp

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

hcomp#

CCSDS 123.0-B Lossless Multispectral and Hyperspectral Image Compression in pure OCaml.

Overview#

Predictor-based lossless compression for multi-band (hyperspectral) images following the CCSDS 123.0-B standard, used for space science data systems. The algorithm uses a local difference predictor with spatial and spectral neighbors followed by an adaptive entropy coder.

Features#

  • Local difference predictor using spatial and spectral neighbors
  • Adaptive entropy coder (Rice-like variable-length coding)
  • Band-interleaved-by-pixel (BIP) sample ordering
  • Support for 1--16 bits per sample

Installation#

Install with opam:

$ opam install hcomp

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install hcomp

Usage#

(* Compress + decompress 256x256 4-band 12-bit imagery. *)
let image_data = Bytes.make (4 * 256 * 256 * 2) '\x00'

let compressed =
  Hcomp.compress ~bands:4 ~width:256 ~height:256 ~bits_per_sample:12 image_data

let restored =
  Hcomp.decompress ~bands:4 ~width:256 ~height:256 ~bits_per_sample:12
    compressed

let () = assert (Bytes.equal restored image_data)

Licence#

ISC License. See LICENSE.md for details.