Main Page | Modules | Alphabetical List | Class List | Directories | Class Members

Masks of pixels


Functions

cpl_mask * cpl_mask_new (int nx, int ny)
 Create a new cpl_mask.
void cpl_mask_delete (cpl_mask *m)
 Delete a cpl_mask.
cpl_binary * cpl_mask_get_data (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.
int cpl_mask_count (const cpl_mask *in)
 Get the number of occurences of CPL_BINARY_1.
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_or (cpl_mask *in1, const cpl_mask *in2)
 Performs a logical OR between two masks.
cpl_error_code cpl_mask_xor (cpl_mask *in1, const cpl_mask *in2)
 Performs a logical XOR between two masks.
cpl_error_code cpl_mask_not (cpl_mask *in)
 Performs a logical NOT on a mask.
cpl_error_code cpl_mask_closing (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological closing.
cpl_error_code cpl_mask_opening (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological opening.
cpl_error_code cpl_mask_erosion (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological erosion.
cpl_error_code cpl_mask_dilation (cpl_mask *in, const cpl_matrix *ker)
 Compute a morphological dilation.
cpl_mask * cpl_mask_new_from_rejected (const cpl_image *in, int *pbadpix, int *pfirstgood)
 Create a mask from an image bad pixels map.
cpl_mask * cpl_mask_new_from_rejected_window (const cpl_image *in, int llx, int lly, int urx, int ury, int *pbadpix, int *pfirstgood)
 Create a mask from an image bad pixels map subwindow.
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_image * cpl_image_labelise_mask_create (const cpl_mask *in, int *nbobjs)
 Labelise a mask to differentiate different objects.

Detailed Description

This module provides functions to handle masks of pixels

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.

Synopsis:
   #include "cpl_mask.h"

Function Documentation

cpl_image* cpl_image_labelise_mask_create const cpl_mask *  in,
int *  nbobjs
 

Labelise a mask to differentiate different objects.

Parameters:
in mask to labelise
nbobjs number of objects found.
Returns:
A newly allocated label image or NULL in error case
This function labelises all blobs in a mask. All 4-neighbour connected zones set to 1 in the input mask will end up in the returned integer image as zones where all pixels are set to the same (unique for this blob in this image) label. A non-recursive flood-fill is applied to label the zones. The flood-fill is dimensioned by the number of lines in the image, and the maximal number of lines possibly covered by a blob. The returned image must be deallocated with cpl_image_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if the input mask is NULL

cpl_error_code cpl_mask_and cpl_mask *  in1,
const cpl_mask *  in2
 

Performs a logical AND between two masks.

Parameters:
in1 first mask
in2 second mask
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The result is stored in the first mask.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the input masks have different sizes

cpl_error_code cpl_mask_closing cpl_mask *  in,
const cpl_matrix *  ker
 

Compute a morphological closing.

Parameters:
in input mask
ker binary kernel (0 for 0, any other value is considered as 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The morphological closing is an erosion followed by a dilation. The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the kernel is such that the erosion or the dilation cannot be done

int cpl_mask_count const cpl_mask *  in  ) 
 

Get the number of occurences of CPL_BINARY_1.

Parameters:
in the input mask
Returns:
the number of occurences of CPL_BINARY_1 or -1 in error case
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL

void cpl_mask_delete cpl_mask *  m  ) 
 

Delete a cpl_mask.

Parameters:
m cpl_mask to delete
Returns:
void

cpl_error_code cpl_mask_dilation cpl_mask *  in,
const cpl_matrix *  ker
 

Compute a morphological dilation.

Parameters:
in input mask
ker binary kernel (0 for 0, any other value is considered as 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the kernel is not as requested

cpl_error_code cpl_mask_erosion cpl_mask *  in,
const cpl_matrix *  ker
 

Compute a morphological erosion.

Parameters:
in input mask
ker binary kernel (0 for 0, any other value is considered as 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the kernel is not as requested

cpl_binary* cpl_mask_get_data const cpl_mask *  in  ) 
 

Get a pointer to the data part of the mask.

Parameters:
in the input mask
Returns:
Pointer to the data or NULL in error case
The returned pointer refers to already allocated data.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL

int cpl_mask_get_size_x const cpl_mask *  in  ) 
 

Get the x size of the mask.

Parameters:
in the input mask
Returns:
The mask x size, or -1 on NULL input
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL

int cpl_mask_get_size_y const cpl_mask *  in  ) 
 

Get the y size of the mask.

Parameters:
in the input mask
Returns:
The mask y size, or -1 on NULL input
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL

cpl_mask* cpl_mask_new int  nx,
int  ny
 

Create a new cpl_mask.

Parameters:
nx number of element in x direction
ny number of element in y direction
Returns:
1 newly allocated cpl_mask or NULL in error case
The returned object must be deallocated using cpl_mask_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_ILLEGAL_INPUT if nx or ny is negative

cpl_mask* cpl_mask_new_from_rejected const cpl_image *  in,
int *  pbadpix,
int *  pfirstgood
 

Create a mask from an image bad pixels map.

Parameters:
in input image
pbadpix on return, pointer to number of set (bad) pixels in result, unless pbadpix == NULL
pfirstgood on return, pointer to first index with unset (good) pixel or -1, unless pfirstgood == NULL
Returns:
a newly allocated mask or NULL on error
See also:
cpl_mask_new_from_rejected_window
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL

cpl_mask* cpl_mask_new_from_rejected_window const cpl_image *  in,
int  llx,
int  lly,
int  urx,
int  ury,
int *  pbadpix,
int *  pfirstgood
 

Create a mask from an image bad pixels map subwindow.

Parameters:
in input image
llx lower left x coord.
lly lower left y coord
urx upper right x coord
ury upper right y coord
pbadpix on return, pointer to number of set (bad) pixels in result, unless pbadpix == NULL
pfirstgood on return, pointer to first index with unset (good) pixel or -1, unless pfirstgood == NULL
Returns:
a newly allocated mask or NULL on error
llx, lly, urx, ury are image region coordinates in FITS convention. If there are no good pixels, *pfirstgood = -1, and the returned image is full of CPL_BINARY_0. The set (bad) pixels are marked with CPL_BINARY_1, the rest with CPL_BINARY_0 The size of the allocated dense matrix is (urx-llx+1) * (ury-lly+1). The returned object must be deallocated with cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the specified window is absurd

cpl_error_code cpl_mask_not cpl_mask *  in  ) 
 

Performs a logical NOT on a mask.

Parameters:
in input mask
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL

cpl_error_code cpl_mask_opening cpl_mask *  in,
const cpl_matrix *  ker
 

Compute a morphological opening.

Parameters:
in input mask
ker binary kernel (0 for 0, any other value is considered as 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The morphological opening is a dilation followed by an erosion. The input mask is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 31x31.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the kernel is such that the erosion or the dilation cannot be done

cpl_error_code cpl_mask_or cpl_mask *  in1,
const cpl_mask *  in2
 

Performs a logical OR between two masks.

Parameters:
in1 first mask
in2 second mask
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
See also:
cpl_mask_and()

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.

Parameters:
in Image to threshold.
lo_cut Lower bound for threshold.
hi_cut Higher bound for threshold.
Returns:
1 newly allocated mask or NULL in error case
Create a mask from an image. Selected areas are the one inside the provided interval. The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. The returned mask must be deallocated with cpl_mask_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if (one of) the input pointer(s) is NULL

cpl_error_code cpl_mask_xor cpl_mask *  in1,
const cpl_mask *  in2
 

Performs a logical XOR between two masks.

Parameters:
in1 first mask
in2 second mask
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
See also:
cpl_mask_and()


Generated on Mon Sep 26 14:38:17 2005 for Common Pipeline Library Reference Manual by  doxygen 1.4.1