Main Page   Modules   Alphabetical List   Compound List   Compound Members  

Binary images


Functions

int cpl_image_binary_getselected (const cpl_image *in)
 Get the number of occurences of CPL_BINARY_1. More...

cpl_error_code cpl_image_binary_and (cpl_image *in1, cpl_image *in2)
 Performs a binary AND between two binary images. More...

cpl_error_code cpl_image_binary_or (cpl_image *in1, cpl_image *in2)
 Performs a binary OR between two binary images. More...

cpl_error_code cpl_image_binary_xor (cpl_image *in1, cpl_image *in2)
 Performs a binary XOR between two binary images. More...

cpl_error_code cpl_image_binary_not (cpl_image *in)
 Performs a binary NOT on a binary image. More...

cpl_error_code cpl_image_binary_closing (cpl_image *in, cpl_matrix *ker)
 Compute a morphological closing. More...

cpl_error_code cpl_image_binary_opening (cpl_image *in, cpl_matrix *ker)
 Compute a morphological opening. More...

cpl_error_code cpl_image_binary_erosion (cpl_image *in, cpl_matrix *ker)
 Compute a morphological erosion. More...

cpl_error_code cpl_image_binary_dilation (cpl_image *in, cpl_matrix *ker)
 Compute a morphological dilation. More...

cpl_image * cpl_image_binary_select (cpl_image *in, double lo_cut, double hi_cut)
 Select parts of an image with provided thresholds. More...

cpl_image * cpl_image_binary_labelize (cpl_image *in, int *nbobjs)
 Labelise a binary map to differentiate different objects. More...


Detailed Description

This module provides functions to handle binary images.

These images 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_image_binary.h"

Function Documentation

cpl_error_code cpl_image_binary_and cpl_image *    in1,
cpl_image *    in2
 

Performs a binary AND between two binary images.

Parameters:
in1  first binary image
in2  second binary image
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The result is stored in the first image. Both images have to be of type CPL_TYPE_UCHAR

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_binary_closing cpl_image *    in,
cpl_matrix *    ker
 

Compute a morphological closing.

Parameters:
in  input binary image
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 image has to be a binary image, and is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 9x9.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_binary_dilation cpl_image *    in,
cpl_matrix *    ker
 

Compute a morphological dilation.

Parameters:
in  input binary image
ker  binary kernel (0 for 0, any other value is considered as 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The input image has to be a binary image, and is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 9x9.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_binary_erosion cpl_image *    in,
cpl_matrix *    ker
 

Compute a morphological erosion.

Parameters:
in  input binary image
ker  binary kernel (0 for 0, any other value is considered as 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The input image has to be a binary image, and is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 9x9.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

int cpl_image_binary_getselected const cpl_image *    in
 

Get the number of occurences of CPL_BINARY_1.

Parameters:
in  binary image
Returns:
the number of occurences of CPL_BINARY_1 or -1 in error case
The input image has to be a binary image.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_image* cpl_image_binary_labelize cpl_image *    in,
int *    nbobjs
 

Labelise a binary map to differentiate different objects.

Parameters:
in  binary image 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 binary image. All 4-neighbour connected zones set to 1 in the input binary image 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
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_binary_not cpl_image *    in
 

Performs a binary NOT on a binary image.

Parameters:
in  binary image
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
Input image has to be of type CPL_TYPE_UCHAR The result is stored in the input image.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_binary_opening cpl_image *    in,
cpl_matrix *    ker
 

Compute a morphological opening.

Parameters:
in  input binary image
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 image has to be a binary image, and is modified. The input kernel should have an odd number of rows and columns. The maximum size of the kernel is 9x9.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_binary_or cpl_image *    in1,
cpl_image *    in2
 

Performs a binary OR between two binary images.

Parameters:
in1  first binary image
in2  second binary image
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
See also:
cpl_image_binary_and()

cpl_image* cpl_image_binary_select 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 binary image or NULL in error case
Create a binary image 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 map must be deallocated with cpl_image_delete()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_binary_xor cpl_image *    in1,
cpl_image *    in2
 

Performs a binary XOR between two binary images.

Parameters:
in1  first binary image
in2  second binary image
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
See also:
cpl_image_binary_and()


Generated on Mon May 24 14:58:05 2004 for Common Pipeline Library Reference Manual by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002