SOMHunter Core
sh::ImageManipulator Class Reference

Provides utilities for image manipulation and processing. More...

#include <image-processor.h>

Static Public Member Functions

template<typename OutType_ >
static OutType_ load_image (const std::string &filepath)
 
static void show_image (const std::string &filepath, size_t delay=0)
 
static void show_image (const cv::Mat image, size_t delay=0)
 
static std::vector< uint8_t > resize (const std::vector< uint8_t > &in, size_t orig_w, size_t orig_h, size_t new_w, size_t new_h, size_t num_channels=3)
 
static void store_JPEG (const std::string &filepath, const std::vector< std::uint8_t > &in, size_t w, size_t h, size_t quality, size_t num_channels)
 
static std::vector< float > to_float32 (const std::vector< std::uint8_t > &in)
 Returns a copy of uint8 buffer from the float one. More...
 
static std::vector< std::uint8_t > to_uint8 (const std::vector< float > &in)
 Returns a copy of float buffer from the uint8 one. More...
 
static void store_PNG (const std::string &filepath, const std::vector< uint8_t > &in, size_t w, size_t h, size_t num_channels)
 Loads the image from the provided filepath. More...
 
static void store_PNG (const std::string &filepath, const std::vector< float > &in, size_t w, size_t h, size_t num_channels)
 
static void store_JPEG (const std::string &filepath, const std::vector< float > &in, size_t w, size_t h, size_t quality=100, size_t num_channels=3, bool are_ints=false)
 
template<>
BitmapImage< float > load_image (const std::string &filepath)
 
template<>
BitmapImage< uint8_t > load_image (const std::string &filepath)
 

Detailed Description

Provides utilities for image manipulation and processing.

Member Function Documentation

◆ load_image() [1/3]

template<>
BitmapImage<float> sh::ImageManipulator::load_image ( const std::string &  filepath)
static

◆ load_image() [2/3]

template<>
BitmapImage<uint8_t> sh::ImageManipulator::load_image ( const std::string &  filepath)
static

◆ load_image() [3/3]

template<typename OutType_ >
static OutType_ sh::ImageManipulator::load_image ( const std::string &  filepath)
static

◆ resize()

std::vector< uint8_t > ImageManipulator::resize ( const std::vector< uint8_t > &  in,
size_t  orig_w,
size_t  orig_h,
size_t  new_w,
size_t  new_h,
size_t  num_channels = 3 
)
static

◆ show_image() [1/2]

static void sh::ImageManipulator::show_image ( const cv::Mat  image,
size_t  delay = 0 
)
inlinestatic

◆ show_image() [2/2]

static void sh::ImageManipulator::show_image ( const std::string &  filepath,
size_t  delay = 0 
)
inlinestatic
Here is the call graph for this function:

◆ store_JPEG() [1/2]

static void sh::ImageManipulator::store_JPEG ( const std::string &  filepath,
const std::vector< float > &  in,
size_t  w,
size_t  h,
size_t  quality = 100,
size_t  num_channels = 3,
bool  are_ints = false 
)
static

◆ store_JPEG() [2/2]

void ImageManipulator::store_JPEG ( const std::string &  filepath,
const std::vector< std::uint8_t > &  in,
size_t  w,
size_t  h,
size_t  quality,
size_t  num_channels 
)
static

◆ store_PNG() [1/2]

static void sh::ImageManipulator::store_PNG ( const std::string &  filepath,
const std::vector< float > &  in,
size_t  w,
size_t  h,
size_t  num_channels 
)
inlinestatic

◆ store_PNG() [2/2]

static void sh::ImageManipulator::store_PNG ( const std::string &  filepath,
const std::vector< uint8_t > &  in,
size_t  w,
size_t  h,
size_t  num_channels 
)
inlinestatic

Loads the image from the provided filepath.

Exceptions
std::runtime_errorIf the loading fails. Writes the provided image into the JPG file.
std::runtime_errorIf the writing fails.

◆ to_float32()

std::vector< float > sh::ImageManipulator::to_float32 ( const std::vector< std::uint8_t > &  in)
static

Returns a copy of uint8 buffer from the float one.

◆ to_uint8()

std::vector< std::uint8_t > sh::ImageManipulator::to_uint8 ( const std::vector< float > &  in)
static

Returns a copy of float buffer from the uint8 one.


The documentation for this class was generated from the following files: