Skip to content

Latest commit

 

History

History
83 lines (76 loc) · 5.13 KB

overview.md

File metadata and controls

83 lines (76 loc) · 5.13 KB

Selene

Overview

Selene is a C++17 image representation, processing and I/O library.

It currently contains, among other things

  • Statically and dynamically typed in-memory pixel and image data representations.

    • Pixel<T, n>: Statically typed multi-channel pixel value.
      • For example, Pixel<std:uint8_t, 3> (shortcut: Pixel_8u3) could represent an 8-bit RGB value, while Pixel<float, 1> represents a single-channel floating point image.
    • Image<T>: Statically typed class representing a 2-D image, owning its data.
      • Example: Image<Pixel_8u1> img_gray({320_px, 240_px}); // 8-bit grayscale image of size (320 x 240)
    • ImageView<T>: Statically typed class representing a 2-D image view, i.e. pointing to non-owned memory. Can be either mutable or constant.
      • Example: MutableImageView<Pixel<double, 10>> img(ptr, {width, height}); // view onto 10-channel floating point image data
    • DynImage: Dynamically typed class representing a 2-D image.
      • Its main use case is as an intermediate representation for decoded image data (from disk or memory) before conversion to a strongly typed Image<T>.
    • DynImageView: Dynamically typed class representing a 2-D image view. Can be either mutable or constant.
    • Interoperability with OpenCV cv::Mat matrices: both wrapping (as view) or copying is supported, in both directions.
  • Functions for reading and writing image data in JPEG, PNG, and TIFF formats (from/to files or memory). The implementation cleanly wraps the libjpeg, libpng, and libtiff APIs.

  • Basic image processing functionality, such as:

    • Image pixel access using various interpolation algorithms (nearest neighbor, bilinear) and boundary handling strategies (no check, replicate boundary, zero padding).
      • Example: const auto u = get<ImageInterpolationMode::Bilinear>(img, 8.5, 10.2);
      • Example: const auto v = get<BorderAccessMode::Replicated>(img, -5_idx, 10_idx);
      • Example: const auto w = get<ImageInterpolationMode::Bilinear, BorderAccessMode::ZeroPadding>(img, x, y)
    • Algorithms to apply point-wise operations to images/views.
      • Example: for_each_pixel(img, [](auto& px){ px += 1; });
      • Example: const auto img_2 = transform_pixels(img, [const auto& px]{ return px + 1; });
    • Pixel-level and image-level conversion functions between different pixel formats (e.g. RGB -> Grayscale, etc.).
      • Example: const auto img_gray = convert_image<PixelFormat::RGB, PixelFormat::Y>(rgb_img);
      • Example: const auto img_bgra = convert_image<PixelFormat::RGB, PixelFormat::BGRA>(rgb_img, 255);
    • Transformations such as transposing, flipping and rotating image data.
      • Example: const auto img_transposed = transpose(img);
      • Example: const auto img_flipped = flip<FlipDirection::Horizontal>(img);
      • Example: const auto img_rotated = rotate<RotationDirection::Clockwise90>(img);
    • Convolution operations using 1-D kernels that can be applied in x- or y-direction on an image.
      • Example: const auto img_convolved = convolution_x<BorderAccessMode::Unchecked>(img, kernel);
  • Functions for binary IO from and to files or memory. The type of source/sink can be transparent to users of this functionality, via static polymorphism.