JWS C Library
C language utility library
|
Definitions for an image block and associated 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/matblock/matblock.h"
#include "jwsc/image/image.h"
#include "jwsc/imgblock/imgblock.h"
Go to the source code of this file.
Functions | |
create_imgblock | |
Creates an image block. | |
void | create_imgblock_f (Imgblock_f **img_out, uint32_t num_imgs, uint32_t num_rows, uint32_t num_cols) |
Creates a single precision floating point image block. | |
create_init_imgblock | |
Creates and initializes an image block. | |
void | create_init_imgblock_f (Imgblock_f **img_out, uint32_t num_imgs, uint32_t num_rows, uint32_t num_cols, Pixel_f val) |
Creates and initializes a single precision floating point image block. | |
create_zero_imgblock | |
Creates an image block and initializes it with zeros. | |
void | create_zero_imgblock_f (Imgblock_f **img_out, uint32_t num_imgs, uint32_t num_rows, uint32_t num_cols) |
Creates a single precision floating point image block and initializes it with zeros. | |
create_random_imgblock_f | |
Creates an image block initializes it with random values. | |
void | create_random_imgblock_f (Imgblock_f **img_out, uint32_t num_imgs, uint32_t num_rows, uint32_t num_cols, Pixel_f min, Pixel_f max) |
Creates a single precision floating point image block and initializes it with random values. | |
create_imgblock_from_matblocks | |
Creates an image block from three matrix blocks. | |
Error * | create_imgblock_from_matblocks_f (Imgblock_f **img_out, const Matblock_f *m_r, const Matblock_f *m_g, const Matblock_f *m_b) |
Creates a single precision floating point image block from three matrix blocks. | |
create_imgblock_from_matblock | |
Creates a grayscale image block from a matrix block. | |
void | create_imgblock_from_matblock_f (Imgblock_f **img_out, const Matblock_f *m) |
Creates a single precision floating point grayscale image block from a matrix block. | |
create_matblocks_from_imgblock | |
Creates three matrix blocks from an image block. | |
void | create_matblocks_from_imgblock_f (Matblock_f **m_r_out, Matblock_f **m_g_out, Matblock_f **m_b_out, const Imgblock_f *img) |
Creates three single precision floating point matrix blocks from an image block. | |
create_matblock_from_imgblock | |
Creates an averaged matrix block from an image block. | |
void | create_matblock_from_imgblock_f (Matblock_f **m_out, const Imgblock_f *img, float r_weight, float g_weight, float b_weight) |
Creates an averaged single precision floating point matrix block from an image block. | |
copy_imgblock | |
Copies an image block. | |
void | copy_imgblock_f (Imgblock_f **img_out, const Imgblock_f *img_in) |
Copies a single precision floating point image block. | |
copy_image_into_imgblock | |
Copies an image into a imgblock. | |
Error * | copy_image_into_imgblock_f (Imgblock_f **ib_out, const Imgblock_f *ib_in, const Image_f *i, Imgblock_image orient, uint32_t index) |
Copies a single precision floating point image into an image block. | |
copy_image_from_imgblock | |
Copies an image from an imgblock. | |
Error * | copy_image_from_imgblock_f (Image_f **img_out, const Imgblock_f *img_blk, Imgblock_image orient, uint32_t index) |
Copies a single precision floating point image from and image block. | |
free_imgblock | |
Frees an image block. | |
void | free_imgblock_f (Imgblock_f *img) |
Frees a single precision floatin point image block. |
Definitions for an image block and associated functions.
The image holds single precision floating point pixel elements.
Although the image is indexed by image, row, and column, the pixels are allocated as a 1D array in row-major order. So iterating over the pixels can be done inside a single loop.
Definition in file imgblock.c.
void create_imgblock_f | ( | Imgblock_f ** | img_out, |
uint32_t | num_imgs, | ||
uint32_t | num_rows, | ||
uint32_t | num_cols | ||
) |
Creates a single precision floating point image block.
img_out | Result parameter. If *img_out is NULL, an image block is allocated; otherwise its space is re-used. |
num_imgs | Number of images in the image block. |
num_rows | Number of rows in the image block. |
num_cols | Number of columns in the image block. |
Definition at line 86 of file imgblock.c.
void create_init_imgblock_f | ( | Imgblock_f ** | img_out, |
uint32_t | num_imgs, | ||
uint32_t | num_rows, | ||
uint32_t | num_cols, | ||
Pixel_f | val | ||
) |
Creates and initializes a single precision floating point image block.
img_out | Result parameter. If *img_out is NULL, an image block is allocated; otherwise its space is re-used. |
num_imgs | Number of images in the image block. |
num_rows | Number of rows in the image block. |
num_cols | Number of columns in the image block. |
val | Pixel value to initialize all pixels of the image block with. |
Definition at line 165 of file imgblock.c.
void create_zero_imgblock_f | ( | Imgblock_f ** | img_out, |
uint32_t | num_imgs, | ||
uint32_t | num_rows, | ||
uint32_t | num_cols | ||
) |
Creates a single precision floating point image block and initializes it with zeros.
img_out | Result parameter. If *img_out is NULL, an image block is allocated; otherwise its space is re-used. |
num_imgs | Number of images in the image block. |
num_rows | Number of rows in the image block. |
num_cols | Number of columns in the image block. |
Definition at line 209 of file imgblock.c.
void create_random_imgblock_f | ( | Imgblock_f ** | img_out, |
uint32_t | num_imgs, | ||
uint32_t | num_rows, | ||
uint32_t | num_cols, | ||
Pixel_f | min, | ||
Pixel_f | max | ||
) |
Creates a single precision floating point image block and initializes it with random values.
Calls rand() to generate the random numbers.
img_out | Result parameter. If *img_out is NULL, an image block is allocated; otherwise its space is re-used. |
num_imgs | Number of images in the image block. |
num_rows | Number of rows in the image block. |
num_cols | Number of columns in the image block. |
min | Minimum random value. |
max | Maximum random value. |
Definition at line 253 of file imgblock.c.
Error* create_imgblock_from_matblocks_f | ( | Imgblock_f ** | img_out, |
const Matblock_f * | m_r, | ||
const Matblock_f * | m_g, | ||
const Matblock_f * | m_b | ||
) |
Creates a single precision floating point image block from three matrix blocks.
img_out | Result parameter. If *img_out is NULL, an image block is allocated; otherwise its space is re-used. |
m_r | Matrix block to copy into the red samples of the image block. |
m_g | Matrix block to copy into the green samples of the image block. |
m_b | Matrix block to copy into the blue samples of the image block. |
Definition at line 310 of file imgblock.c.
void create_imgblock_from_matblock_f | ( | Imgblock_f ** | img_out, |
const Matblock_f * | m | ||
) |
Creates a single precision floating point grayscale image block from a matrix block.
img_out | Result parameter. If *img_out is NULL, an image block is allocated; otherwise its space is re-used. |
m | Matrix block to copy into the red, green and blue samples of the image. |
Definition at line 370 of file imgblock.c.
void create_matblocks_from_imgblock_f | ( | Matblock_f ** | m_r_out, |
Matblock_f ** | m_g_out, | ||
Matblock_f ** | m_b_out, | ||
const Imgblock_f * | img | ||
) |
Creates three single precision floating point matrix blocks from an image block.
m_r_out | Result parameter. Red sample matrix block. If *m_r_out is NULL, an image block is allocated; otherwise its space is re-used. |
m_g_out | Result parameter. Green sample matrix block. If *m_g_out is NULL, an image block is allocated; otherwise its space is re-used. |
m_b_out | Result parameter. Blue sample matrix block. If *m_b_out is NULL, an image block is allocated; otherwise its space is re-used. |
img | Image block to copy into the matrix blocks. |
Definition at line 403 of file imgblock.c.
void create_matblock_from_imgblock_f | ( | Matblock_f ** | m_out, |
const Imgblock_f * | img, | ||
float | r_weight, | ||
float | g_weight, | ||
float | b_weight | ||
) |
Creates an averaged single precision floating point matrix block from an image block.
The weights are normalized to sum to one.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
img | Image block to copy into the matrix block. |
r_weight | Weight of the red sample. |
g_weight | Weight of the green sample. |
b_weight | Weight of the blue sample. |
Definition at line 461 of file imgblock.c.
void copy_imgblock_f | ( | Imgblock_f ** | img_out, |
const Imgblock_f * | img_in | ||
) |
Copies a single precision floating point image block.
img_out | Result parameter. If *img_out is NULL, an image block is allocated; otherwise its space is re-used. |
img_in | Image block to copy. |
Definition at line 516 of file imgblock.c.
Error* copy_image_into_imgblock_f | ( | Imgblock_f ** | ib_out, |
const Imgblock_f * | ib_in, | ||
const Image_f * | i, | ||
Imgblock_image | orient, | ||
uint32_t | index | ||
) |
Copies a single precision floating point image into an image block.
ib_out | Result parameter. If *ib_out is NULL, a image block is allocated; otherwise its space is re-used. |
ib_in | Image block to copy a image into. |
i | Image to copy into the image block. |
orient | Orientation of the image to copy into the image block. |
index | Index along the orientation dimension to copy the image into the image block. |
Definition at line 566 of file imgblock.c.
Error* copy_image_from_imgblock_f | ( | Image_f ** | img_out, |
const Imgblock_f * | img_blk, | ||
Imgblock_image | orient, | ||
uint32_t | index | ||
) |
Copies a single precision floating point image from and image block.
img_out | Result parameter. If *img_out is NULL, an image is allocated; otherwise its space is re-used. |
img_blk | Image block to copy an image from. |
orient | Orientation of the image to copy from the image block. |
index | Index along the orientation dimension to copy the image from the image block. |
Definition at line 675 of file imgblock.c.
void free_imgblock_f | ( | Imgblock_f * | img | ) |
Frees a single precision floatin point image block.
img | Image block to free. |
Definition at line 763 of file imgblock.c.