Mamba C API reference

Version 2.0

MB_Api.h File Reference

Go to the source code of this file.

Functions

MB_API_ENTRY MB_errcode MB_API_CALL MB_And (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Or (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Xor (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Inv (MB_Image *src, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Inf (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Sup (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_SupMask (MB_Image *src1, MB_Image *src2, MB_Image *dest, Uint32 strict)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Add (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Sub (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Mul (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Div (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Diff (MB_Image *src1, MB_Image *src2, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConAdd (MB_Image *src, Sint64 value, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConSub (MB_Image *src, Sint64 value, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConMul (MB_Image *src, Uint32 value, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConDiv (MB_Image *src, Uint32 value, MB_Image *dest)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConSet (MB_Image *dest, Uint32 value)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Volume (MB_Image *src, Uint64 *pVolume)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Check (MB_Image *src, Uint32 *isEmpty)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Lookup (MB_Image *src, MB_Image *dest, Uint32 *ptab)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Histo (MB_Image *src, Uint32 *phisto)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Compare (MB_Image *src, MB_Image *cmp, MB_Image *dest, Sint32 *px, Sint32 *py)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Thresh (MB_Image *src, MB_Image *dest, Uint32 low, Uint32 high)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Mask (MB_Image *src, MB_Image *dest, Uint32 maskf, Uint32 maskt)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Range (MB_Image *src, Uint32 *min, Uint32 *max)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_depthRange (MB_Image *src, Uint32 *min, Uint32 *max)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_CopyBitPlane (MB_Image *src, MB_Image *dest, Uint32 plane)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_CopyBytePlane (MB_Image *src, MB_Image *dest, Uint32 plane)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Label (MB_Image *src, MB_Image *dest, Uint32 lblow, Uint32 lbhigh, Uint32 *pNbobj, enum MB_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Distanceb (MB_Image *src, MB_Image *dest, enum MB_grid_t grid, enum MB_edgemode_t edge)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Frame (MB_Image *src, Uint32 thresval, Uint32 *ulx, Uint32 *uly, Uint32 *brx, Uint32 *bry)
 

Function Documentation

MB_API_ENTRY MB_errcode MB_API_CALL MB_Add ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Adds the pixels of two images and puts the result in the third image. Depending on the format of the target image, the result may be saturated or not. You can perform the following additions :

  • 1-bit + 1-bit = 1-bit (binary OR)
  • 1-bit + 8-bit = 8-bit (saturated)
  • 1-bit + 8-bit = 32-bit
  • 1-bit + 32-bit = 32-bit
  • 8-bit + 8-bit = 8-bit (saturated)
  • 8-bit + 8-bit = 32-bit
  • 8-bit + 32-bit = 32-bit
  • 32-bit + 32-bit = 32-bit
See also
MB_Or for the binary OR definition.
Parameters
src1image 1
src2image 2
destimage resulting of the addition of image 1 and 2
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_And ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Performs a bitwise AND between the pixels of two images.

Parameters
src1image 1
src2image 2
destdestination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Check ( MB_Image src,
Uint32 isEmpty 
)

Verifies that the image is not empty (all pixels to 0).

Parameters
srcthe source image
isEmptyan integer which is set to 1 if empty or 0 if not
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Compare ( MB_Image src,
MB_Image cmp,
MB_Image dest,
Sint32 px,
Sint32 py 
)

Performs a comparaison between a source image and a given base image.

Parameters
srcthe source image
cmpthe image to which the source image is compared
destdestination image
pxposition in x of the first different pixel between the two images (-1 if images are similar)
pyposition in y of the first different pixel between the two images (-1 if images are similar)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConAdd ( MB_Image src,
Sint64  value,
MB_Image dest 
)

Adds a constant value to the pixels of an image.

Parameters
srcthe source image
valuethe constant value to be added to the pixels
destthe image resulting of the addition of image 1 and value
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConDiv ( MB_Image src,
Uint32  value,
MB_Image dest 
)

Divides (quotient) the pixels of an image by a constant value.

Parameters
srcthe source image
valuethe constant value used in the division
destthe image resulting of the division of image 1 by the value
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConMul ( MB_Image src,
Uint32  value,
MB_Image dest 
)

Multiplies a constant value to the pixels of an image.

Parameters
srcthe source image
valuethe constant value to be multiplied to the pixels
destthe image resulting of the multiplication of image 1 by the value
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConSet ( MB_Image dest,
Uint32  value 
)

Fills an image with a specific value.

Parameters
destthe image
valuethe value to fill the image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_ConSub ( MB_Image src,
Sint64  value,
MB_Image dest 
)

Subtracts a constant value to the pixels of an image.

Parameters
srcthe source image
valuethe constant value to be subtracted to the pixels
destthe image resulting of the subtraction of image 1 and value
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_CopyBitPlane ( MB_Image src,
MB_Image dest,
Uint32  plane 
)

Inserts or extracts the bit plane in/out of image src into dest.

Parameters
srcsource image
destdestination image
planethe plane number
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_CopyBytePlane ( MB_Image src,
MB_Image dest,
Uint32  plane 
)

Inserts or extracts the byte plane in/out of image src into dest.

Parameters
srcsource image
destdestination image
planethe plane number
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_depthRange ( MB_Image src,
Uint32 min,
Uint32 max 
)

gives the minimum and maximum possible values of the image pixels given the image depth.

Parameters
srcsource image
minthe minimum possible value of the pixels
maxthe maximum possible value of the pixels
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Diff ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Computes the set difference between two images. The result image pixel value is the pixel value of image 1 if this value was greater than value of pixel 2 otherwise the minimum possible value is set for the pixel.

Parameters
src1source image 1
src2source image 2
destdestination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Distanceb ( MB_Image src,
MB_Image dest,
enum MB_grid_t  grid,
enum MB_edgemode_t  edge 
)

Computes for each pixel the distance to the edge of the set in which the pixel is found.

The algorithm works with a list.

Parameters
srcthe binary source image
destthe 32-bit image in which the distance for each pixel is stored
gridthe grid used (either hexagonal or square)
edgethe kind of edge to use (behavior for pixels near edge depends on it)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Div ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Divides the pixels of two images and puts the result in the third image. You can perform the following multiplications :

  • 8-bit / 8-bit = 8-bit (saturated)
  • 8-bit / 8-bit = 32-bit
  • 32-bit / 8-bit = 32-bit
  • 32-bit / 32-bit = 32-bit

Division by zero results in the maximum value possible for the pixels of the destination image depth.

Parameters
src1image 1
src2image 2
destimage resulting of the division of image 1 and 2 (quotient)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Frame ( MB_Image src,
Uint32  thresval,
Uint32 ulx,
Uint32 uly,
Uint32 brx,
Uint32 bry 
)

Returns the smallest frame that contains all the pixels of image that are greater or equal to the given threshold value, using the four last pointers to describe it.

Parameters
srcsource image
thresvalthe threshold value used to compute the frame
ulxthe x-coordinate of the upper left corner of the frame
ulythe y-coordinate of the upper left corner of the frame
brxthe x-coordinate of the bottom right corner of the frame
brythe y-coordinate of the bottom right corner of the frame
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Histo ( MB_Image src,
Uint32 phisto 
)

Computes the histogram of an image. The histogram is an array with a minimal size of 256.

Parameters
srcsource image
phistopointer to the histogram array
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Inf ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Determines the inferior value between the pixels of two images. The result is put in the corresponding pixel position in the destination image.

Parameters
src1image 1
src2image 2
destdestination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Inv ( MB_Image src,
MB_Image dest 
)

Inverts the pixels values (logical NOT) of the source image.

Parameters
srcsource image
destdestination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Label ( MB_Image src,
MB_Image dest,
Uint32  lblow,
Uint32  lbhigh,
Uint32 pNbobj,
enum MB_grid_t  grid 
)

Labeling the object found in src image.

Parameters
srcthe source image where the object must be labelled
destthe 32-bit image where object are labelled
lblowthe lowest value allowed for label on the low byte (must be inferior to lbhigh)
lbhighthe first high value NOT allowed for label on the low byte (maximum allowed is 256)
pNbobjthe number of object found
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Lookup ( MB_Image src,
MB_Image dest,
Uint32 ptab 
)

Applies the function in the lookup table to the pixels of source image. A pixel value is changed to a new value accordingly with its current value.

Parameters
srcsource image
destdestination image
ptabthe lookup table pointer
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Mask ( MB_Image src,
MB_Image dest,
Uint32  maskf,
Uint32  maskt 
)

Converts a binary image in a grey scale image (8-bit) or in a 32-bit image using value maskf to replace 0 and maskt to replace 1.

Parameters
srcbinary source image
destdestination image
maskffor 0 (false) pixel value
masktfor 1 (true) pixel value
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Mul ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Multiplies the pixels of two images and puts the result in the third image. Depending on the format of the target image, the result may be saturated or not. You can perform the following multiplications :

  • 1-bit * 1-bit = 1-bit (binary AND)
  • 1-bit * 8-bit = 8-bit
  • 1-bit * 8-bit = 32-bit
  • 1-bit * 32-bit = 32-bit
  • 8-bit * 8-bit = 8-bit (saturated)
  • 8-bit * 8-bit = 32-bit
  • 8-bit * 32-bit = 32-bit
  • 32-bit * 32-bit = 32-bit
See also
MB_And for the binary AND.
Parameters
src1image 1
src2image 2
destimage resulting of the multiplication of image 1 and 2
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Or ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Applies a bitwise OR on the pixels of two images. All the images must have the same depth for correct work.

Parameters
src1image 1
src2image 2
destdestination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Range ( MB_Image src,
Uint32 min,
Uint32 max 
)

gives the minimum and maximum values of the image pixels i.e its range.

Parameters
srcsource image
minthe minimum value of the pixels
maxthe maximum value of the pixels
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Sub ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Subtracts the values of pixels of the second image to the values of the pixels in the first image You can perform the following substractions :

  • 1-bit - 1-bit = 1-bit (binary AND)
  • 8-bit - 1-bit = 8-bit (saturated)
  • 8-bit - 8-bit = 8-bit (saturated)
  • 8-bit - 8-bit = 32-bit
  • 8-bit - 32-bit = 32-bit
  • 32-bit - 8-bit = 32-bit
  • 32-bit - 32-bit = 32-bit
See also
MB_Diff for the set difference.
Parameters
src1image 1
src2image 2
destimage resulting of the subtraction
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Sup ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Determines the superior value between the pixels of two images. The result is put in the corresponding pixel position in the destination image.

Parameters
src1image 1
src2image 2
destdestination image
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_SupMask ( MB_Image src1,
MB_Image src2,
MB_Image dest,
Uint32  strict 
)

Computes a binary image where pixels are set to 1 when the pixels of image 1 have greater values than pixels of image 2 otherwise 0.

Parameters
src1source image 1
src2source image 2
destdestination image
strictflag indicating if the comparison is strict or large
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Thresh ( MB_Image src,
MB_Image dest,
Uint32  low,
Uint32  high 
)

Fills a binary image according to the following rules: if pixel value lower than low or higher than high the binary pixel is set to 0, in other cases the pixel is set to 1.

Parameters
srcsource image
destdestination image
lowlow value for threshold
highhigh value for treshold
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Volume ( MB_Image src,
Uint64 pVolume 
)

Computes the volume of an image. The volume is the sum of the pixel values (i.e. integration of the image).

Parameters
srcsource image
pVolumepointer to the volume variable
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Xor ( MB_Image src1,
MB_Image src2,
MB_Image dest 
)

Applies a bitwise XOR on the pixels of two images. All the images must have the same depth for correct work.

Parameters
src1image 1
src2image 2
destdestination image
Returns
An error code (NO_ERR if successful)