Functions | |
cpl_error_code | cpl_mask_and (cpl_mask *in1, const cpl_mask *in2) |
Performs a logical AND between two masks. | |
cpl_error_code | cpl_mask_closing (cpl_mask *in, const cpl_matrix *ker) |
Compute a morphological closing. | |
cpl_mask * | cpl_mask_collapse_create (const cpl_mask *in, int dir) |
Collapse a mask. | |
cpl_error_code | cpl_mask_copy (cpl_mask *in1, const cpl_mask *in2, int x_pos, int y_pos) |
Insert a mask in an other one. | |
int | cpl_mask_count (const cpl_mask *in) |
Get the number of occurences of CPL_BINARY_1. | |
int | cpl_mask_count_window (const cpl_mask *self, int llx, int lly, int urx, int ury) |
Get the number of occurences of CPL_BINARY_1 in a window. | |
void | cpl_mask_delete (cpl_mask *m) |
Delete a cpl_mask. | |
cpl_error_code | cpl_mask_dilation (cpl_mask *in, const cpl_matrix *ker) |
Compute a morphological dilation. | |
cpl_mask * | cpl_mask_duplicate (const cpl_mask *in) |
Duplicates a cpl_mask. | |
cpl_error_code | cpl_mask_erosion (cpl_mask *in, const cpl_matrix *ker) |
Compute a morphological erosion. | |
cpl_mask * | cpl_mask_extract (const cpl_mask *in, int llx, int lly, int urx, int ury) |
Extract a mask from an other one. | |
cpl_mask * | cpl_mask_extract_subsample (const cpl_mask *in, int xstep, int ystep) |
Subsample a mask. | |
cpl_error_code | cpl_mask_flip (cpl_mask *in, int angle) |
Flip a mask on a given miror line. | |
cpl_binary | cpl_mask_get (const cpl_mask *in, int xpos, int ypos) |
Get the value of a mask at a given position. | |
cpl_binary * | cpl_mask_get_data (cpl_mask *in) |
Get a pointer to the data part of the mask. | |
const cpl_binary * | cpl_mask_get_data_const (const cpl_mask *in) |
Get a pointer to the data part of the mask. | |
int | cpl_mask_get_size_x (const cpl_mask *in) |
Get the x size of the mask. | |
int | cpl_mask_get_size_y (const cpl_mask *in) |
Get the y size of the mask. | |
cpl_boolean | cpl_mask_is_empty (const cpl_mask *self) |
Return CPL_TRUE iff a mask has no elements set (to CPL_BINARY_1). | |
cpl_boolean | cpl_mask_is_empty_window (const cpl_mask *self, int llx, int lly, int urx, int ury) |
Return CPL_TRUE iff a mask has no elements set in the window. | |
cpl_error_code | cpl_mask_move (cpl_mask *in, int nb_cut, const int *new_pos) |
Reorganize the pixels in a mask. | |
cpl_mask * | cpl_mask_new (int nx, int ny) |
Create a new cpl_mask. | |
cpl_error_code | cpl_mask_not (cpl_mask *in) |
Performs a logical NOT on a mask. | |
cpl_error_code | cpl_mask_opening (cpl_mask *in, const cpl_matrix *ker) |
Compute a morphological opening. | |
cpl_error_code | cpl_mask_or (cpl_mask *in1, const cpl_mask *in2) |
Performs a logical OR between two masks. | |
cpl_error_code | cpl_mask_set (cpl_mask *self, int xpos, int ypos, cpl_binary value) |
Set a value in a mask at a given position. | |
cpl_error_code | cpl_mask_shift (cpl_mask *self, int dx, int dy) |
Shift a mask. | |
cpl_mask * | cpl_mask_threshold_image_create (const cpl_image *in, double lo_cut, double hi_cut) |
Select parts of an image with provided thresholds. | |
cpl_error_code | cpl_mask_turn (cpl_mask *self, int rot) |
Rotate a mask by a multiple of 90 degrees counterclockwise. | |
void * | cpl_mask_unwrap (cpl_mask *m) |
Delete a cpl_mask except the data array. | |
cpl_mask * | cpl_mask_wrap (int nx, int ny, cpl_binary *data) |
Create a cpl_mask from existing data. | |
cpl_error_code | cpl_mask_xor (cpl_mask *in1, const cpl_mask *in2) |
Performs a logical XOR between two masks. |
These masks are useful for object detection routines or bad pixel map handling. Morphological routines (erosion, dilation, closing and opening) and logical operations are provided. A cpl_mask is a kind of binary array whose elements are of type cpl_binary and can take only two values: either CPL_BINARY_0 or CPL_BINARY_1.
#include "cpl_mask.h"
cpl_error_code cpl_mask_and | ( | cpl_mask * | in1, | |
const cpl_mask * | in2 | |||
) |
Performs a logical AND between two masks.
in1 | first mask | |
in2 | second mask |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_closing | ( | cpl_mask * | in, | |
const cpl_matrix * | ker | |||
) |
Compute a morphological closing.
in | input mask | |
ker | binary kernel (0 for 0, any other value is considered as 1) |
Possible _cpl_error_code_ set in this function:
cpl_mask* cpl_mask_collapse_create | ( | const cpl_mask * | in, | |
int | dir | |||
) |
Collapse a mask.
in | input mask to collapse | |
dir | collapsing direction |
Collapse along y: 1 0 1 Input mask. 0 1 1 0 0 1 ----- 0 0 1 The third element is flagged as bad because all elements of the column are bad.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_copy | ( | cpl_mask * | in1, | |
const cpl_mask * | in2, | |||
int | x_pos, | |||
int | y_pos | |||
) |
Insert a mask in an other one.
in1 | mask in which in2 is inserted | |
in2 | mask to insert | |
x_pos | the x pixel position in in1 where the lower left pixel of in2 should go (from 1 to the x size of in1) | |
y_pos | the y pixel position in in1 where the lower left pixel of in2 should go (from 1 to the y size of in1) |
int cpl_mask_count | ( | const cpl_mask * | in | ) |
Get the number of occurences of CPL_BINARY_1.
in | the input mask |
int cpl_mask_count_window | ( | const cpl_mask * | self, | |
int | llx, | |||
int | lly, | |||
int | urx, | |||
int | ury | |||
) |
Get the number of occurences of CPL_BINARY_1 in a window.
self | The mask to count | |
llx | Lower left x position (FITS convention) | |
lly | Lower left y position (FITS convention) | |
urx | Upper right x position (FITS convention) | |
ury | Upper right y position (FITS convention) |
void cpl_mask_delete | ( | cpl_mask * | m | ) |
Delete a cpl_mask.
m | cpl_mask to delete |
NULL
, nothing is done, and no error is set.
cpl_error_code cpl_mask_dilation | ( | cpl_mask * | in, | |
const cpl_matrix * | ker | |||
) |
Compute a morphological dilation.
in | input mask | |
ker | binary kernel (0 for 0, any other value is considered as 1) |
Possible _cpl_error_code_ set in this function:
cpl_mask* cpl_mask_duplicate | ( | const cpl_mask * | in | ) |
Duplicates a cpl_mask.
in | the mask to duplicate |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_erosion | ( | cpl_mask * | in, | |
const cpl_matrix * | ker | |||
) |
Compute a morphological erosion.
in | input mask | |
ker | binary kernel (0 for 0, any other value is considered as 1) |
Possible _cpl_error_code_ set in this function:
cpl_mask* cpl_mask_extract | ( | const cpl_mask * | in, | |
int | llx, | |||
int | lly, | |||
int | urx, | |||
int | ury | |||
) |
Extract a mask from an other one.
in | input mask | |
llx | coordinates of the extracted mask | |
lly | ||
urx | ||
ury |
Possible _cpl_error_code_ set in this function:
cpl_mask* cpl_mask_extract_subsample | ( | const cpl_mask * | in, | |
int | xstep, | |||
int | ystep | |||
) |
Subsample a mask.
in | input mask | |
xstep | Take every xstep pixel in x | |
ystep | Take every ystep pixel in y |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_flip | ( | cpl_mask * | in, | |
int | angle | |||
) |
Flip a mask on a given miror line.
in | mask to flip | |
angle | mirror line in polar coord. is theta = (PI/4) * angle |
Possible _cpl_error_code_ set in this function:
cpl_binary cpl_mask_get | ( | const cpl_mask * | in, | |
int | xpos, | |||
int | ypos | |||
) |
Get the value of a mask at a given position.
in | the input mask | |
xpos | x position (FITS convention) | |
ypos | y position (FITS convention) |
Possible _cpl_error_code_ set in this function:
cpl_binary* cpl_mask_get_data | ( | cpl_mask * | in | ) |
Get a pointer to the data part of the mask.
in | the input mask |
Possible _cpl_error_code_ set in this function:
const cpl_binary* cpl_mask_get_data_const | ( | const cpl_mask * | in | ) |
Get a pointer to the data part of the mask.
in | the input mask |
int cpl_mask_get_size_x | ( | const cpl_mask * | in | ) |
Get the x size of the mask.
in | the input mask |
int cpl_mask_get_size_y | ( | const cpl_mask * | in | ) |
Get the y size of the mask.
in | the input mask |
cpl_boolean cpl_mask_is_empty | ( | const cpl_mask * | self | ) |
Return CPL_TRUE iff a mask has no elements set (to CPL_BINARY_1).
self | The mask to search |
cpl_boolean cpl_mask_is_empty_window | ( | const cpl_mask * | self, | |
int | llx, | |||
int | lly, | |||
int | urx, | |||
int | ury | |||
) |
Return CPL_TRUE iff a mask has no elements set in the window.
self | The mask to search | |
llx | Lower left x position (FITS convention) | |
lly | Lower left y position (FITS convention) | |
urx | Upper right x position (FITS convention) | |
ury | Upper right y position (FITS convention) |
cpl_error_code cpl_mask_move | ( | cpl_mask * | in, | |
int | nb_cut, | |||
const int * | new_pos | |||
) |
Reorganize the pixels in a mask.
in | mask to collapse | |
nb_cut | the number of cut in x and y | |
new_pos | array with the nb_cut^2 new positions |
Possible _cpl_error_code_ set in this function:
cpl_mask* cpl_mask_new | ( | int | nx, | |
int | ny | |||
) |
Create a new cpl_mask.
nx | number of element in x direction | |
ny | number of element in y direction |
The returned object must be deallocated using cpl_mask_delete().
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_not | ( | cpl_mask * | in | ) |
Performs a logical NOT on a mask.
in | input mask |
cpl_error_code cpl_mask_opening | ( | cpl_mask * | in, | |
const cpl_matrix * | ker | |||
) |
Compute a morphological opening.
in | input mask | |
ker | binary kernel (0 for 0, any other value is considered as 1) |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_or | ( | cpl_mask * | in1, | |
const cpl_mask * | in2 | |||
) |
Performs a logical OR between two masks.
in1 | first mask | |
in2 | second mask |
cpl_error_code cpl_mask_set | ( | cpl_mask * | self, | |
int | xpos, | |||
int | ypos, | |||
cpl_binary | value | |||
) |
Set a value in a mask at a given position.
self | the input mask | |
xpos | x position (FITS convention) | |
ypos | y position (FITS convention) | |
value | the value to set in the mask |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_shift | ( | cpl_mask * | self, | |
int | dx, | |||
int | dy | |||
) |
Shift a mask.
self | Mask to shift in place | |
dx | Shift in X | |
dy | Shift in Y |
Possible _cpl_error_code_ set in this function:
cpl_mask* cpl_mask_threshold_image_create | ( | const cpl_image * | in, | |
double | lo_cut, | |||
double | hi_cut | |||
) |
Select parts of an image with provided thresholds.
in | Image to threshold. | |
lo_cut | Lower bound for threshold. | |
hi_cut | Higher bound for threshold. |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_turn | ( | cpl_mask * | self, | |
int | rot | |||
) |
Rotate a mask by a multiple of 90 degrees counterclockwise.
self | Mask to rotate in place | |
rot | The multiple: -1 is a rotation of 90 deg clockwise. |
Possible _cpl_error_code_ set in this function:
void* cpl_mask_unwrap | ( | cpl_mask * | m | ) |
Delete a cpl_mask except the data array.
m | cpl_mask to delete |
cpl_mask* cpl_mask_wrap | ( | int | nx, | |
int | ny, | |||
cpl_binary * | data | |||
) |
Create a cpl_mask from existing data.
nx | number of element in x direction | |
ny | number of element in y direction | |
data | Pointer to array of nx*ny cpl_binary |
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_mask_xor | ( | cpl_mask * | in1, | |
const cpl_mask * | in2 | |||
) |
Performs a logical XOR between two masks.
in1 | first mask | |
in2 | second mask |