Img2Num C++
API Documentation
img2num Namespace Reference

Enumerations

enum class  Error {
  OK = 0 , BAD_ALLOC = 1 , INVALID_ARGUMENT = 2 , RUNTIME = 3 ,
  UNKNOWN = 4
}
 

Functions

Error get_last_error ()
 
const std::string get_last_error_message ()
 
void clear_last_error ()
 
void set_error (Error code, const std::string message)
 
template<typename Func , typename... Args>
void clear_last_error_and_catch (Func &&exception_prone_func, Args &&... args)
 
void gaussian_blur_fft (uint8_t *image, size_t width, size_t height, double sigma)
 
void invert_image (uint8_t *ptr, int width, int height)
 
void threshold_image (uint8_t *ptr, const int width, const int height, const int num_thresholds)
 
void black_threshold_image (uint8_t *ptr, const int width, const int height, const int num_thresholds)
 
void kmeans (const uint8_t *data, uint8_t *out_data, int32_t *out_labels, const int32_t width, const int32_t height, const int32_t k, const int32_t max_iter, const uint8_t color_space)
 
void bilateral_filter (uint8_t *image, size_t width, size_t height, double sigma_spatial, double sigma_range, uint8_t color_space)
 
char * labels_to_svg (uint8_t *data, int32_t *labels, const int width, const int height, const int min_area, const bool draw_contour_borders)
 

Variables

thread_local Error last_error
 
thread_local std::string last_error_message
 

Detailed Description

Note
All image buffers are assumed to be stored in row-major order, unless otherwise noted.

Function Documentation

◆ bilateral_filter()

void img2num::bilateral_filter ( uint8_t *  image,
size_t  width,
size_t  height,
double  sigma_spatial,
double  sigma_range,
uint8_t  color_space 
)

◆ black_threshold_image()

void img2num::black_threshold_image ( uint8_t *  ptr,
const int  width,
const int  height,
const int  num_thresholds 
)

◆ gaussian_blur_fft()

void img2num::gaussian_blur_fft ( uint8_t *  image,
size_t  width,
size_t  height,
double  sigma 
)

◆ invert_image()

void img2num::invert_image ( uint8_t *  ptr,
int  width,
int  height 
)

◆ kmeans()

void img2num::kmeans ( const uint8_t *  data,
uint8_t *  out_data,
int32_t *  out_labels,
const int32_t  width,
const int32_t  height,
const int32_t  k,
const int32_t  max_iter,
const uint8_t  color_space 
)

◆ labels_to_svg()

char* img2num::labels_to_svg ( uint8_t *  data,
int32_t *  labels,
const int  width,
const int  height,
const int  min_area,
const bool  draw_contour_borders 
)

◆ threshold_image()

void img2num::threshold_image ( uint8_t *  ptr,
const int  width,
const int  height,
const int  num_thresholds 
)