A C++14 image representation, processing and I/O library.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis Travis-CI: notice build failures. Jun 11, 2018
benchmark Conversion of Pixel<> instantiations to include PixelType. Jun 11, 2018
cmake Remove thread pool implementation; now in separate library/repository. Nov 10, 2018
data Added official PNG suite images to tests. Nov 20, 2017
docs Remove thread pool implementation; now in separate library/repository. Nov 10, 2018
examples Remove VC++ warning in example code. Jun 11, 2018
external Added conanfile.py recipe. May 10, 2018
package Split off libraries selene_img_io and selene_img_ops from selene_img. Nov 10, 2018
scripts Use Docker in travis.yml. Jun 2, 2018
selene Split off libraries selene_img_io and selene_img_ops from selene_img. Nov 10, 2018
test/selene Remove thread pool implementation; now in separate library/repository. Nov 10, 2018
.clang-format Extended the Doxygen documentation. Dec 21, 2017
.clang-tidy Removed a few clang-tidy warnings. May 11, 2018
.gitignore Fixed clang-format script. May 21, 2018
.gitmodules Cleaned up .gitmodules Jan 7, 2018
.lvimrc Made a few type conversions more explicit. May 13, 2018
.travis.yml Use Docker in travis.yml. Jun 2, 2018
.ycm_extra_conf.py Updated YCM and ALE config files. Nov 29, 2017
CMakeLists.txt Revert C++ standard setting. Nov 10, 2018
CODE_OF_CONDUCT.md Created CODE_OF_CONDUCT.md. Feb 12, 2018
CONTRIBUTING.md Added first version of contribution guidelines. Feb 12, 2018
Doxyfile Updated URL to Doxygen docs. Updated Doxyfile. May 25, 2018
DoxygenLayout.xml Slightly nicer Doxygen documentation. Dec 27, 2017
LICENSE Added conanfile.py recipe. May 10, 2018
README.md Update README.md. Jun 11, 2018
appveyor.yml Fix excluded branches in appveyor.xml. Jun 2, 2018
conanfile.txt Simplified Conan support; requires Conan >= 1.4.1. Jun 2, 2018

README.md

Selene

Build Status Build status

Selene is a C++14 image representation, processing, and I/O library, focusing on ease of use and a clean, modern, type-safe API.

Summary

  • Strongly typed image and multi-channel pixel representations, and functions for image data access.
  • Easy-to-use APIs to read and write images in JPEG and PNG formats (leveraging libjpeg and libpng).
  • Basic image processing algorithms such as color conversions, pixel-wise operations, rotation, flipping, etc.
  • Lightweight and easy to build using CMake on Linux, MacOS, Windows.

Example

A first impression of the API:

// Decode JPEG image data from disk
ImageData<> img_data = read_image(FileReader(example_img_path.string()));
assert(img_data.nr_channels() == 3 && img_data.nr_bytes_per_channel() == 1);

// Convert to strongly typed RGB image
Image<PixelRGB_8u> img_rgb = to_image<PixelRGB_8u>(std::move(img_data));
assert(img_rgb.width() > 400_px && img_rgb.height() > 350_px);

// Create non-owning view on part of the image
Image<PixelRGB_8u> img_part = view(img_rgb, 100_idx, 100_idx, 300_px, 250_px);

// Darken this part
for_each_pixel(img_part, [](auto& px){ px /= 4; });

// Flip this part horizontally
flip_horizontally_in_place(img_part);

// Convert whole image to RGBA, adding semi-transparent alpha channel
const Image<PixelRGBA_8u> img_rgba =
    convert_image<PixelFormat::RGBA>(img_rgb, std::uint8_t{128});

// Encode in-memory to PNG
std::vector<std::uint8_t> encoded_png_data;
write_image(to_image_data_view(img_rgba), ImageFormat::PNG,
            VectorWriter(encoded_png_data));

// Write encoded binary data to disk (or do something else with it...)
write_data_contents("example_out.png", encoded_png_data);

Introductory presentation

Here is a PDF format presentation that introduces Selene (~v.0.1.0) and some of its features, given at a meetup of the Dutch C++ Group.

Selene: Image representation and I/O in C++14

Package managed

Building from source "at head" using CMake is the recommended way to use Selene (see Building the library). But the library is also available as a

Selene's own dependencies can be installed using

besides OS level package managers or from source.