JWS C Library
C language utility library
|
Definitions for image utility functions. More...
#include <jwsc/config.h>
#include <stdlib.h>
#include <inttypes.h>
#include <math.h>
#include <assert.h>
#include "jwsc/base/error.h"
#include "jwsc/matrix/matrix.h"
#include "jwsc/filter/2d.h"
#include "jwsc/image/image.h"
#include "jwsc/image/image_util.h"
Go to the source code of this file.
Functions | |
Error * | crop_image_f (Image_f **img_out, const Image_f *img_in, uint32_t row, uint32_t col, uint32_t num_rows, uint32_t num_cols) |
Crops a single precision image into a padding region. | |
down_sample_image | |
Down samples an image. | |
Error * | down_sample_image_f (Image_f **img_out, const Image_f *img_in, float row_factor, float col_factor) |
Down samples a single precision image. | |
extend_image | |
Extends an image into a padding region. | |
void | extend_image_f (Image_f **img_out, const Image_f *img_in, uint32_t row_padding, uint32_t col_padding) |
Extends a single precision image into a padding region. | |
threshold_image | |
Thresholds an image. | |
void | threshold_image_f (Matrix_f **mat_out, const Image_f *img_in, float t) |
Thresholds a single precision image. | |
threshold_matrix | |
Thresholds a matrix. | |
void | threshold_matrix_f (Matrix_f **mat_out, const Matrix_f *mat_in, float t) |
Thresholds a single precision matrix. | |
dynamically_threshold_image | |
Dynamically thresholds a image. | |
void | dynamically_threshold_image_f (Matrix_f **mat_out, const Image_f *img_in) |
Dynamically thresholds a single precision image. | |
dynamically_threshold_matrix | |
Dynamically thresholds a matrix. | |
void | dynamically_threshold_matrix_f (Matrix_f **mat_out, const Matrix_f *mat_in) |
Dynamically thresholds a single precision matrix. |
Definitions for image utility functions.
Definition in file image_util.c.
Error* down_sample_image_f | ( | Image_f ** | img_out, |
const Image_f * | img_in, | ||
float | row_factor, | ||
float | col_factor | ||
) |
Down samples a single precision image.
Uses a Gaussian smoothing function to down sample.
img_out | Result parameter. If *img_out is NULL, an image is allocated; otherwise its space is re-used. |
img_in | Image to down sample. |
row_factor | Percentage of current number of rows to down sample the number of rows in the image to, in the range (0,1]. |
col_factor | Percentage of current number of columns to down sample the number of columns in the image to, in the range (0,1]. |
Definition at line 87 of file image_util.c.
void extend_image_f | ( | Image_f ** | img_out, |
const Image_f * | img_in, | ||
uint32_t | row_padding, | ||
uint32_t | col_padding | ||
) |
Extends a single precision image into a padding region.
img_out | Result parameter. If *img_out is NULL, an image is allocated; otherwise its space is re-used. |
img_in | Image to extend. |
row_padding | Number or rows for padding on top and bottom. |
col_padding | Number of columns for padding on left and right. |
Definition at line 273 of file image_util.c.
Error* crop_image_f | ( | Image_f ** | img_out, |
const Image_f * | img_in, | ||
uint32_t | row, | ||
uint32_t | col, | ||
uint32_t | num_rows, | ||
uint32_t | num_cols | ||
) |
Crops a single precision image into a padding region.
img_out | Result parameter. If *img_out is NULL, an image is allocated; otherwise its space is re-used. |
img_in | Image to crop. |
row | First row to use in the cropped result. |
col | First col to use in the cropped result. |
num_rows | Number of rows to use in the cropped result. |
num_cols | Number of cols to use in the cropped result. |
Definition at line 361 of file image_util.c.
Thresholds a single precision image.
The image is converted to grayscale and thresholded with t as follows
m[i,j] < t : m[i,j] = 0 m[i,j] >= t : m[i,j] = 1
Definition at line 438 of file image_util.c.
Thresholds a single precision matrix.
The matrix is thresholded with t as follows
m[i,j] < t : m[i,j] = 0 m[i,j] >= t : m[i,j] = 1
Definition at line 469 of file image_util.c.
Dynamically thresholds a single precision image.
A threshold t is iteratively found as the average between the mean foreground and background values.
The image is converted to grayscale and thresholded with t as follows
m[i,j] < t : m[i,j] = 0 m[i,j] >= t : m[i,j] = 1
Definition at line 523 of file image_util.c.
Dynamically thresholds a single precision matrix.
A threshold t is iteratively found as the average between the mean foreground and background values.
The matrix is thresholded with t as follows
m[i,j] < t : m[i,j] = 0 m[i,j] >= t : m[i,j] = 1
Definition at line 556 of file image_util.c.