Image pixels as signal
Pixels
(Image
) can be treated as signal. Conversion to signal is based on strategies of converting image to RAW and then converting to audio. It includes channel data layout and packing into integer, encoding, endianess, etc.
To convert Pixels
to signal use pixels->signal
function. To convert back use signal->pixels
. signal->pixels
requires target Pixels
object to store result of conversion. Target is mutated then.
To filter Pixels
directly (without explicit conversion to and from Signals) you can use [[filter-channels]] with effects-filter
.
Image pixels as signal ### Pixels as Signal `Pixels` (`Image`) can be treated as signal. Conversion to signal is based on strategies of converting image to RAW and then converting to audio. It includes channel data layout and packing into integer, encoding, endianess, etc. To convert `Pixels` to signal use [[pixels->signal]] function. To convert back use [[signal->pixels]]. [[signal->pixels]] requires target `Pixels` object to store result of conversion. Target is mutated then. To filter `Pixels` directly (without explicit conversion to and from Signals) you can use [[filter-channels]] with [[effects-filter]].
(apply-effects-to-pixels effects pixels)
(apply-effects-to-pixels effects reset pixels)
(apply-effects-to-pixels effects config config-back pixels)
(apply-effects-to-pixels effects config config-back reset pixels)
Apply effects directly to Pixels
.
Provide configurations to properly convert Pixels to Signal and back.
Optionally set reset
value (reinit effects' state after reset
samples).
If you prefer operating through [[filter-channels]] use [[effect-filter]].
Apply effects directly to `Pixels`. Provide configurations to properly convert Pixels to Signal and back. Optionally set `reset` value (reinit effects' state after `reset` samples). If you prefer operating through [[filter-channels]] use [[effect-filter]].
(effects-filter effects)
(effects-filter effects reset)
(effects-filter effects config config-back)
(effects-filter effects config config-back reset)
Creates filter to process Pixels
as Signal
using [[filter-channels]].
Provide configurations to properly convert Pixels to Signal and back.
Optionally set reset
value (reinit effects' state after reset
samples).
Filter operates on one channel at time and is defined to be used with [[filter-channels]].
If you want to operate on Pixels
directly, use apply-effects-to-pixels
.
Creates filter to process `Pixels` as `Signal` using [[filter-channels]]. Provide configurations to properly convert Pixels to Signal and back. Optionally set `reset` value (reinit effects' state after `reset` samples). Filter operates on one channel at time and is defined to be used with [[filter-channels]]. If you want to operate on `Pixels` directly, use [[apply-effects-to-pixels]].
(pixels->signal p)
(pixels->signal p
{:keys [planar? signed? little-endian? bits channels coding]
:or {planar? true
little-endian? true
bits 8
signed? false
channels [0 1 2]
coding :none}})
Convert Pixels
to Signal
for given specifications.
Specification for conversion is based on Audacity importing options and image to RAW conversions practices. Spec contains:
planar?
- layout of channels data, planar (true, default) or interleaved (false)signed?
- channel data are encoded as signed (true, default) or unsigned (false) integer.little-endian?
- for 16 and 24 bits pack channel data with little-endian order (true, default) or big-endian (false)bits
- pack channel data in 8 (default), 16 or 24 bits.channels
- list of channels to convert to signal, default [0 1 2]
(for all you can use :all
keyword).coding
- encode signal with one of the encoders: :alaw
, :alaw-rev
, :ulaw
, :ulaw-rev
or :none
(default).Pixels can be restored from Signal with signal->pixels
function.
Convert `Pixels` to `Signal` for given specifications. Specification for conversion is based on Audacity importing options and image to RAW conversions practices. Spec contains: * `planar?` - layout of channels data, planar (true, default) or interleaved (false) * `signed?` - channel data are encoded as signed (true, default) or unsigned (false) integer. * `little-endian?` - for 16 and 24 bits pack channel data with little-endian order (true, default) or big-endian (false) * `bits` - pack channel data in 8 (default), 16 or 24 bits. * `channels` - list of channels to convert to signal, default `[0 1 2]` (for all you can use `:all` keyword). * `coding` - encode signal with one of the encoders: `:alaw`, `:alaw-rev`, `:ulaw`, `:ulaw-rev` or `:none` (default). Pixels can be restored from Signal with [[signal->pixels]] function.
(signal->pixels sig target)
(signal->pixels sig
target
{:keys [planar? signed? little-endian? bits channels coding]
:or {planar? true
little-endian? true
bits 8
signed? false
channels [0 1 2]
coding :none}})
Convert Signal
to Pixels
storing result into target
(mutating it!).
Specification is the same as in [[pixels-signal]] functions.
Convert `Signal` to `Pixels` storing result into `target` (mutating it!). Specification is the same as in [[pixels-signal]] functions.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close