The OpenVX Specification  dba1aa3

Detailed Description

Extracts LBP image from an input image. The output image dimensions should be the same as the dimensions of the input image.

The function calculates one of the following LBP descriptors: Local Binary Pattern, Modified Local Binary Pattern, or Uniform Local Binary Pattern.
local binary pattern is defined as: Each pixel (y,x) generate an 8 bit value describing the local binary pattern around the pixel, by comparing the pixel value with its 8 neighbours (selected neighbours of the 3x3 or 5x5 window).
We will define the pixels for the 3x3 neighbourhood as:

\begin{align} g_0 &=& SrcImg[y-1,x-1] \nonumber\\ g_1 &=& SrcImg[y-1,x ] \nonumber\\ g_2 &=& SrcImg[y-1,x+1] \nonumber\\ g_3 &=& SrcImg[y ,x+1] \nonumber\\ g_4 &=& SrcImg[y+1,x+1] \nonumber\\ g_5 &=& SrcImg[y+1,x ] \nonumber\\ g_6 &=& SrcImg[y+1,x-1] \nonumber\\ g_7 &=& SrcImg[y ,x-1] \nonumber\\ g_c &=& SrcImg[y ,x ] \nonumber\\ \end{align}

and the pixels in a 5x5 neighbourhood as:

\begin{align} g_0 &=& SrcImg[y-1,x-1] \nonumber\\ g_1 &=& SrcImg[y-2,x ] \nonumber\\ g_2 &=& SrcImg[y-1,x+1] \nonumber\\ g_3 &=& SrcImg[y ,x+2] \nonumber\\ g_4 &=& SrcImg[y+1,x+1] \nonumber\\ g_5 &=& SrcImg[y+2,x ] \nonumber\\ g_6 &=& SrcImg[y+1,x-1] \nonumber\\ g_7 &=& SrcImg[y ,x-2] \nonumber\\ g_c &=& SrcImg[y ,x ] \nonumber\\ \end{align}

We also define the sign difference function:

\begin{align} s(x) &=& \begin{cases} 1 & x >= 0 \\ 0 & x < 0 \end{cases} \end{align}

Using the above definitions. The LBP image is defined in the following equation:

\[ DstImg[y,x] = \sum_{p=0}^{7} s(g_p - g_c)2^p \]

For modified local binary pattern. Each pixel (y,x) generate an 8 bit value describing the modified local binary pattern around the pixel, by comparing the average of 8 neighbour pixels with its 8 neighbours (5x5 window).

\begin{align} Avg[y,x] &=& ((SrcImg[y-2,x-2]) \nonumber \\ &+& (SrcImg[y-2,x ]) \nonumber \\ &+& (SrcImg[y-2,x+2]) \nonumber \\ &+& (SrcImg[y ,x+2]) \nonumber \\ &+& (SrcImg[y+2,x+2]) \nonumber \\ &+& (SrcImg[y+2,x ]) \nonumber \\ &+& (SrcImg[y+2,x-2]) \nonumber \\ &+& (SrcImg[y ,x-2])+1)/8 \end{align}


\begin{align} DstImg[y,x] &=& ((SrcImg[y-2,x-2] > Avg[y,x])) \nonumber \\ &|& ((SrcImg[y-2,x ] > Avg [y,x]) << 1) \nonumber \\ &|& ((SrcImg[y-2,x+2] > Avg [y,x]) << 2) \nonumber \\ &|& ((SrcImg[y ,x+2] > Avg [y,x]) << 3) \nonumber \\ &|& ((SrcImg[y+2,x+2] > Avg [y,x]) << 4) \nonumber \\ &|& ((SrcImg[y+2,x ] > Avg [y,x]) << 5) \nonumber \\ &|& ((SrcImg[y+2,x-2] > Avg [y,x]) << 6) \nonumber \\ &|& ((SrcImg[y ,x-2] > Avg [y,x]) << 7) \end{align}

The uniform LBP patterns refer to the patterns which have limited transition or discontinuities (smaller then 2 or equal) in the circular binary presentation.
For each pixel (y,x) a value is generated, describing the transition around the pixel (If there are up to 2 transitions between 0 to 1 or 1 to 0). And an additional value for all other local binary pattern values. We can define the function that measure transition as:

\[ U = |s(g_7 - g_c) - s(g_0 - g_c)| + \sum_{p=1}^{7} |s(g_p - g_c) - s(g_{p-1} - g_c)| \]

With the above definitions, the unified LBP equation is defined as.

\[ DstImg[y,x] = \begin{cases} \sum_{p=0}^{7} s(g_p - g_c)2^p & U <= 2 \\ 9 & otherwise \end{cases} \]

Enumerations

enum  vx_lbp_format_e {
  VX_LBP = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_LBP_FORMAT << 12)) + 0x0,
  VX_MLBP = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_LBP_FORMAT << 12)) + 0x1,
  VX_ULBP = ((( VX_ID_KHRONOS ) << 20) | ( VX_ENUM_LBP_FORMAT << 12)) + 0x2
}
 Local binary pattern supported. More...
 

Functions

vx_node VX_API_CALL vxLBPNode (vx_graph graph, vx_image in, vx_enum format, vx_int8 kernel_size, vx_image out)
 [Graph] Creates a node that extracts LBP image from an input image More...
 
vx_status VX_API_CALL vxuLBP (vx_context context, vx_image in, vx_enum format, vx_int8 kernel_size, vx_image out)
 [Immediate] The function extracts LBP image from an input image More...
 

Enumeration Type Documentation

Local binary pattern supported.

Enumerator
VX_LBP 

local binary pattern

VX_MLBP 

Modified Local Binary Patterns.

VX_ULBP 

Uniform local binary pattern.

Definition at line 1428 of file vx_types.h.

Function Documentation

vx_node VX_API_CALL vxLBPNode ( vx_graph  graph,
vx_image  in,
vx_enum  format,
vx_int8  kernel_size,
vx_image  out 
)

[Graph] Creates a node that extracts LBP image from an input image

Parameters
[in]graphThe reference to the graph.
[in]inAn input image in vx_image. Or \( SrcImg\) in the equations. the image is of type VX_DF_IMAGE_U8
[in]formatA variation of LBP like original LBP and mLBP. see vx_lbp_format_e
[in]kernel_sizeKernel size. Only size of 3 and 5 are supported
[out]outAn output image in vx_image.Or \( DstImg\) in the equations. the image is of type VX_DF_IMAGE_U8 with the same dimensions as the input image.
Returns
vx_node.
Return values
vx_nodeA node reference. Any possible errors preventing a successful creation should be checked using vxGetStatus
vx_status VX_API_CALL vxuLBP ( vx_context  context,
vx_image  in,
vx_enum  format,
vx_int8  kernel_size,
vx_image  out 
)

[Immediate] The function extracts LBP image from an input image

Parameters
[in]contextThe reference to the overall context.
[in]inAn input image in vx_image. Or \( SrcImg\) in the equations. the image is of type VX_DF_IMAGE_U8
[in]formatA variation of LBP like original LBP and mLBP. see vx_lbp_format_e
[in]kernel_sizeKernel size. Only size of 3 and 5 are supported
[out]outAn output image in vx_image.Or \( DstImg\) in the equations. the image is of type VX_DF_IMAGE_U8
Returns
A vx_status_e enumeration.
Return values
VX_SUCCESSSuccess
*An error occurred. See vx_status_e.