4 #include "img2num/Error.h"
9 img2num::clear_last_error_and_catch(img2num::gaussian_blur_fft, image, width, height, sigma);
13 img2num::clear_last_error_and_catch(img2num::invert_image, image, width, height);
17 const int num_thresholds) {
18 img2num::clear_last_error_and_catch(img2num::threshold_image, ptr, width, height,
23 const int num_thresholds) {
24 img2num::clear_last_error_and_catch(img2num::black_threshold_image, ptr, width, height,
28 void img2num_kmeans(
const uint8_t *data, uint8_t *out_data, int32_t *out_labels,
29 const int32_t width,
const int32_t height,
const int32_t k,
30 const int32_t max_iter,
const uint8_t color_space) {
31 img2num::clear_last_error_and_catch(img2num::kmeans, data, out_data, out_labels, width, height,
32 k, max_iter, color_space);
36 double sigma_range, uint8_t color_space) {
37 img2num::clear_last_error_and_catch(img2num::bilateral_filter, image, width, height,
38 sigma_spatial, sigma_range, color_space);
42 const int min_area,
const bool draw_contour_borders) {
43 char *result{
nullptr};
44 img2num::clear_last_error_and_catch(
45 [&](uint8_t *d, int32_t *l,
int w,
int h,
int min_a,
bool draw_contours) {
46 result = img2num::labels_to_svg(d, l, w, h, min_a, draw_contours);
48 data, labels, width, height, min_area, draw_contour_borders);
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)
Convert labeled regions of an image into an SVG string.
void img2num_threshold_image(uint8_t *ptr, const int width, const int height, const int num_thresholds)
Apply a thresholding operation to an image.
void img2num_invert_image(uint8_t *image, int width, int height)
Invert the pixel values of an image.
void img2num_gaussian_blur_fft(uint8_t *image, size_t width, size_t height, double sigma)
Apply a Gaussian blur to an image using FFT.
void img2num_black_threshold_image(uint8_t *ptr, const int width, const int height, const int num_thresholds)
Apply black-thresholding to an image.
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)
Perform k-means clustering on image data.
void img2num_bilateral_filter(uint8_t *image, size_t width, size_t height, double sigma_spatial, double sigma_range, uint8_t color_space)
Apply bilateral filtering to an image.
Core image processing functions for img2num project.