ifw-odp
2.0.0-alpha
|
#include "clipm_priv_matrix.h"
#include "clipm_math.h"
#include "clipm_priv_checks.h"
#include "clipm_compatibility_replacements.h"
#include "clipm_priv_error.h"
#include <math.h>
Macros | |
#define | clipm_COPY_WINDOW_TO_MATRIX(TYPE, image, imsize, windowsize, buffer_start, out_buffer, flip) |
Functions | |
cpl_matrix * | clipm_priv_matrix_new_from_image_window (const cpl_image *image, const cpl_size window_xxyy[4], const int vflip) |
Extract an image window into a matrix, flip vertically. More... | |
cpl_error_code | clipm_priv_matrix_round (cpl_matrix *matrix) |
Round the elements of a matrix to the nearest integer. More... | |
cpl_matrix * | clipm_priv_matrix_get_median_rows (const cpl_matrix *matrix) |
Get the medians of the values in the matrix rows respectively. More... | |
cpl_matrix * | clipm_priv_matrix_get_mean_rows (const cpl_matrix *matrix) |
Get the means of the values in the matrix rows respectively. More... | |
cpl_matrix * | clipm_priv_matrix_select_cols (const cpl_matrix *matrix, const int *selection, int select_nonzero) |
Return selected columns in a new matrix. More... | |
cpl_error_code | clipm_priv_matrix_copy_col_vector (cpl_matrix *matrix, const cpl_vector *vector, cpl_size col, cpl_size start_row) |
Copy the content of a vector into a matrix column (or a part of it). More... | |
cpl_error_code | clipm_priv_matrix_copy_vector_col (cpl_vector *vector, const cpl_matrix *matrix, cpl_size col, cpl_size start_row) |
Copy the content of a matrix column (or a part of it) into a vector. More... | |
cpl_error_code | clipm_priv_matrix_transform_create_rot2d (double angle, const double centre_xy[2], cpl_matrix **transform, cpl_matrix **shift) |
Create a 2d rotation matrix. More... | |
cpl_error_code | clipm_priv_matrix_transform_invert (const cpl_matrix *transf, const cpl_matrix *shift, cpl_matrix **inv_transf, cpl_matrix **inv_shift) |
Compute the inverse transform. More... | |
cpl_matrix * | clipm_priv_matrix_transform_points (const cpl_matrix *points, const cpl_matrix *transformation, const cpl_matrix *shift) |
Transform a pointlist. More... | |
cpl_matrix * | clipm_priv_matrix_create_corners_rectangle (const double centre_xy[2], double angle, const double size_lw[2]) |
Create a matrix containing the corner points of a rectangle. More... | |
void | clipm_priv_matrix_null (cpl_matrix **m) |
Delete a CPL matrix object and set the pointer to NULL. More... | |
#define clipm_COPY_WINDOW_TO_MATRIX | ( | TYPE, | |
image, | |||
imsize, | |||
windowsize, | |||
buffer_start, | |||
out_buffer, | |||
flip | |||
) |
cpl_error_code clipm_priv_matrix_copy_col_vector | ( | cpl_matrix * | matrix, |
const cpl_vector * | vector, | ||
cpl_size | col, | ||
cpl_size | start_row | ||
) |
Copy the content of a vector into a matrix column (or a part of it).
matrix | Modified matrix |
vector | Input vector |
col | Matrix column index |
start_row | Index of the starting matrix row |
cpl_error_code clipm_priv_matrix_copy_vector_col | ( | cpl_vector * | vector, |
const cpl_matrix * | matrix, | ||
cpl_size | col, | ||
cpl_size | start_row | ||
) |
Copy the content of a matrix column (or a part of it) into a vector.
vector | Modified vector |
matrix | Input matrix |
col | Matrix column index |
start_row | Index of the starting matrix row |
cpl_matrix* clipm_priv_matrix_create_corners_rectangle | ( | const double | centre_xy[2], |
double | angle, | ||
const double | size_lw[2] | ||
) |
Create a matrix containing the corner points of a rectangle.
centre_xy | Centre coordinate as (x,y) tuple |
angle | Orientation |
size_lw | Length and width as a data tuple, the first entry (size_lw[0]) will point into the direction of angle |
The output matrix will contain (x,y) tuples in 4 columns, respectively.
cpl_matrix* clipm_priv_matrix_get_mean_rows | ( | const cpl_matrix * | matrix | ) |
Get the means of the values in the matrix rows respectively.
matrix | N x M input matrix |
cpl_matrix* clipm_priv_matrix_get_median_rows | ( | const cpl_matrix * | matrix | ) |
Get the medians of the values in the matrix rows respectively.
matrix | N x M input matrix |
cpl_matrix* clipm_priv_matrix_new_from_image_window | ( | const cpl_image * | image, |
const cpl_size | window_xxyy[4], | ||
const int | vflip | ||
) |
Extract an image window into a matrix, flip vertically.
image | Input image (FITS convention) |
window_xxyy | Coordinate buffer (FITS) of the form {xa, xb, ya, yb}, can be NULL, minimum/maximum order is irrelevant |
vflip | Flag whether to vertically flip the data buffer |
void clipm_priv_matrix_null | ( | cpl_matrix ** | m | ) |
Delete a CPL matrix object and set the pointer to NULL.
m | Pointer to matrix pointer |
The following code is executed:
cpl_error_code clipm_priv_matrix_round | ( | cpl_matrix * | matrix | ) |
Round the elements of a matrix to the nearest integer.
matrix | The matrix |
cpl_matrix* clipm_priv_matrix_select_cols | ( | const cpl_matrix * | matrix, |
const int * | selection, | ||
int | select_nonzero | ||
) |
Return selected columns in a new matrix.
matrix | N x M input matrix |
selection | Integer buffer of size M containing the selection flags |
select_nonzero | Flag to either select columns with a selection flag equal to zero or different from zero |
cpl_error_code clipm_priv_matrix_transform_create_rot2d | ( | double | angle, |
const double | centre_xy[2], | ||
cpl_matrix ** | transform, | ||
cpl_matrix ** | shift | ||
) |
Create a 2d rotation matrix.
angle | Rotation angle |
centre_xy | (Optional) rotation centre (double buffer of size 2), if it is NULL, then (0, 0) is assumed as centre |
transform | (Optional output) transformation matrix |
shift | (Optional output) shift vector |
cpl_error_code clipm_priv_matrix_transform_invert | ( | const cpl_matrix * | transf, |
const cpl_matrix * | shift, | ||
cpl_matrix ** | inv_transf, | ||
cpl_matrix ** | inv_shift | ||
) |
Compute the inverse transform.
transf | Input transformation matrix |
shift | Input shift vector |
inv_transf | Output transformation matrix |
inv_shift | Output shift vector |
cpl_matrix* clipm_priv_matrix_transform_points | ( | const cpl_matrix * | points, |
const cpl_matrix * | transformation, | ||
const cpl_matrix * | shift | ||
) |
Transform a pointlist.
points | ND x NP (number of dimensions, times number of points) matrix containing the point coordinates |
transformation | The ND x ND square transformation matrix, can be NULL |
shift | The ND x 1 shift matrix (vector), can be NULL |