octu0 / wavelet

a simple wavelet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wavelet

simple wavelet implementation.

Example

package main

import (
	"math"

	"github.com/octu0/wavelet"
)

func main() {
	high, low := wavelet.Haar([]float64{1.0, 2.0, 3.0, 4.0, 5.0, 8.0})
	println(high) // => [2.12.., 4.94.., 9.19]
	println(low)  // => [-0.707.., -0.707.., -2.12..]

	out := wavelet.InverseHaar(high, low)
	println(out)  // => [0.999, 1.999, 3.000, 3.999, 5.000, 7.999]

	for i, v := range out {
		out[i] = math.Ceil(v)
	}
	println(out)  // => [1, 2, 3, 5, 8]
}

Example RGBA

An example of converting an image to an intermediate format is implemented in _example

source image

original
source img
intermediate img
substract 55% img
substract 75% img
substract 85% img
substract 95% img
inverse img
runlength-enc 104KB
runlength-dec img

License

MIT, see LICENSE file for details.

About

a simple wavelet

License:MIT License


Languages

Language:Go 100.0%