A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/xtensor-stack/xtensor-io below:

xtensor-stack/xtensor-io: xtensor plugin to read and write images, audio files, numpy (compressed) npz and HDF5

Reading and writing image, sound and npz file formats to and from xtensor data structures.
Try it live in the browser!

xtensor-io offers an API to read and write various file formats into xtensor data structures:

xtensor-io wraps the OpenImageIO, libsndfile, zlib, HighFive, and blosc libraries.

xtensor-io is a header-only library. We provide a package for the mamba (or conda) package manager.

mamba install xtensor-io -c conda-forge

All five libraries are available for the conda package manager.

You can also install xtensor-io from source:

mkdir build
cd build
cmake ..
make
sudo make install

To try out xtensor-io interactively in your web browser, just click on the binder link:

To get started with using xtensor-io, check out the full documentation

http://xtensor-io.readthedocs.io/

// loads png image into xarray with shape HEIGHT x WIDTH x CHANNELS
auto img_arr = xt::load_image("test.png");

// write xarray out to JPEG image
xt::dump_image("dumptest.jpg", img_arr + 5);

// load npz file containing multiple arrays
auto npy_map = xt::load_npz("test.npz");

auto arr_0 = npy_map["arr_0"].cast<double>();
auto arr_1 = npy_map["arr_1"].cast<unsigned long>();

// open a wav file
auto audio = xt::load_audio("files/xtensor.wav");
auto& audio_arr = std::get<1>(audio); // audio contents (like scipy.io.wavfile results)

// save a sine wave sound
int freq = 2000;
int sampling_freq = 44100;
double duration = 1.0;

auto t = xt::arange(0.0, duration, 1.0 / sampling_freq);
auto y = xt::sin(2.0 * xt::numeric_constants<double>::PI * freq * t);

xt::dump_audio("files/sine.wav", y, sampling_freq);

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the LICENSE file for details.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4