All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ColorDebayer
Color and Sampling Conversion

Grayscale Color Filter Array to RGB Color Debayer conversion. More...

## Functions

NppStatus | nppiCFAToRGB_8u_C1C3R_Ctx (const Npp8u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp8u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation, NppStreamContext nppStreamCtx)
| 1 channel 8-bit unsigned packed CFA grayscale Bayer pattern to 3 channel 8-bit unsigned packed RGB conversion. More...
NppStatus | nppiCFAToRGB_8u_C1C3R (const Npp8u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp8u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation)
NppStatus | nppiCFAToRGBA_8u_C1AC4R_Ctx (const Npp8u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp8u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation, Npp8u nAlpha, NppStreamContext nppStreamCtx)
| 1 channel 8-bit unsigned packed CFA grayscale Bayer pattern to 4 channel 8-bit unsigned packed RGB conversion with alpha. More...
NppStatus | nppiCFAToRGBA_8u_C1AC4R (const Npp8u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp8u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation, Npp8u nAlpha)
NppStatus | nppiCFAToRGB_16u_C1C3R_Ctx (const Npp16u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp16u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation, NppStreamContext nppStreamCtx)
| 1 channel 16-bit unsigned packed CFA grayscale Bayer pattern to 3 channel 16-bit unsigned packed RGB conversion. More...
NppStatus | nppiCFAToRGB_16u_C1C3R (const Npp16u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp16u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation)
NppStatus | nppiCFAToRGBA_16u_C1AC4R_Ctx (const Npp16u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp16u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation, Npp16u nAlpha, NppStreamContext nppStreamCtx)
| 1 channel 16-bit unsigned packed CFA grayscale Bayer pattern to 4 channel 16-bit unsigned packed RGB conversion with alpha. More...
NppStatus | nppiCFAToRGBA_16u_C1AC4R (const Npp16u *pSrc, int nSrcStep, NppiSize oSrcSize, NppiRect oSrcROI, Npp16u *pDst, int nDstStep, NppiBayerGridPosition eGrid, NppiInterpolationMode eInterpolation, Npp16u nAlpha)

## Detailed Description

Grayscale Color Filter Array to RGB Color Debayer conversion.

Generates one RGB color pixel for every grayscale source pixel. Source and destination images must have even width and height. Missing pixel colors are generated using bilinear interpolation with chroma correlation of generated green values (eInterpolation MUST be set to 0). eGrid allows the user to specify the Bayer grid registration position at source image location oSrcROI.x, oSrcROI.y relative to pSrc. Possible registration positions are:

* NPPI_BAYER_BGGR NPPI_BAYER_RGGB NPPI_BAYER_GBRG NPPI_BAYER_GRBG
*
* B G R G G B G R
* G R G B R G B G
*
*

If it becomes necessary to access source pixels outside source image then the source image borders are mirrored.

Here is how the algorithm works. R, G, and B base pixels from the source image are used unmodified. To generate R values for those G pixels, the average of R(x - 1, y) and R(x + 1, y) or R(x, y - 1) and R(x, y + 1) is used depending on whether the left and right or top and bottom pixels are R base pixels. To generate B values for those G pixels, the same algorithm is used using nearest B values. For an R base pixel, if there are no B values in the upper, lower, left, or right adjacent pixels then B is the average of B values in the 4 diagonal (G base) pixels. The same algorithm is used using R values to generate the R value of a B base pixel. Chroma correlation is applied to generated G values only, for a B base pixel G(x - 1, y) and G(x + 1, y) are averaged or G(x, y - 1) and G(x, y + 1) are averaged depending on whether the absolute difference between B(x, y) and the average of B(x - 2, y) and B(x + 2, y) is smaller than the absolute difference between B(x, y) and the average of B(x, y - 2) and B(x, y + 2). For an R base pixel the same algorithm is used testing against the surrounding R values at those offsets. If the horizontal and vertical differences are the same at one of those pixels then the average of the four left, right, upper and lower G values is used instead.

## Function Documentation

NppStatus nppiCFAToRGB_16u_C1C3R | ( | const Npp16u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp16u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation
| ) |  |

NppStatus nppiCFAToRGB_16u_C1C3R_Ctx | ( | const Npp16u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp16u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation,
|  | NppStreamContext | nppStreamCtx
| ) |  |

1 channel 16-bit unsigned packed CFA grayscale Bayer pattern to 3 channel 16-bit unsigned packed RGB conversion.

Parameters

  pSrc | Source-Image Pointer.
  nSrcStep | Source-Image Line Step.
  oSrcSize | full source image width and height relative to pSrc.
  oSrcROI | rectangle specifying starting source image pixel x and y location relative to pSrc and ROI width and height.
  pDst | Destination-Image Pointer.
  nDstStep | Destination-Image Line Step.
  eGrid | enumeration value specifying bayer grid registration position at location oSrcROI.x, oSrcROI.y relative to pSrc.
  eInterpolation | MUST be NPPI_INTER_UNDEFINED
  nppStreamCtx | Application Managed Stream Context.

Returns
  Image Data Related Error Codes, ROI Related Error Codes

NppStatus nppiCFAToRGB_8u_C1C3R | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation
| ) |  |

NppStatus nppiCFAToRGB_8u_C1C3R_Ctx | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation,
|  | NppStreamContext | nppStreamCtx
| ) |  |

1 channel 8-bit unsigned packed CFA grayscale Bayer pattern to 3 channel 8-bit unsigned packed RGB conversion.

Parameters

  pSrc | Source-Image Pointer.
  nSrcStep | Source-Image Line Step.
  oSrcSize | full source image width and height relative to pSrc.
  oSrcROI | rectangle specifying starting source image pixel x and y location relative to pSrc and ROI width and height.
  pDst | Destination-Image Pointer.
  nDstStep | Destination-Image Line Step.
  eGrid | enumeration value specifying bayer grid registration position at location oSrcROI.x, oSrcROI.y relative to pSrc.
  eInterpolation | MUST be NPPI_INTER_UNDEFINED
  nppStreamCtx | Application Managed Stream Context.

Returns
  Image Data Related Error Codes, ROI Related Error Codes

NppStatus nppiCFAToRGBA_16u_C1AC4R | ( | const Npp16u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp16u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation,
|  | Npp16u | nAlpha
| ) |  |

NppStatus nppiCFAToRGBA_16u_C1AC4R_Ctx | ( | const Npp16u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp16u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation,
|  | Npp16u | nAlpha,
|  | NppStreamContext | nppStreamCtx
| ) |  |

1 channel 16-bit unsigned packed CFA grayscale Bayer pattern to 4 channel 16-bit unsigned packed RGB conversion with alpha.

Parameters

  pSrc | Source-Image Pointer.
  nSrcStep | Source-Image Line Step.
  oSrcSize | full source image width and height relative to pSrc.
  oSrcROI | rectangle specifying starting source image pixel x and y location relative to pSrc and ROI width and height.
  pDst | Destination-Image Pointer.
  nDstStep | Destination-Image Line Step.
  eGrid | enumeration value specifying bayer grid registration position at location oSrcROI.x, oSrcROI.y relative to pSrc.
  eInterpolation | MUST be NPPI_INTER_UNDEFINED
  nAlpha | constant alpha value to be written to each destination pixel
  nppStreamCtx | Application Managed Stream Context.

Returns
  Image Data Related Error Codes, ROI Related Error Codes

NppStatus nppiCFAToRGBA_8u_C1AC4R | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation,
|  | Npp8u | nAlpha
| ) |  |

NppStatus nppiCFAToRGBA_8u_C1AC4R_Ctx | ( | const Npp8u * | pSrc,
|  | int | nSrcStep,
|  | NppiSize | oSrcSize,
|  | NppiRect | oSrcROI,
|  | Npp8u * | pDst,
|  | int | nDstStep,
|  | NppiBayerGridPosition | eGrid,
|  | NppiInterpolationMode | eInterpolation,
|  | Npp8u | nAlpha,
|  | NppStreamContext | nppStreamCtx
| ) |  |

1 channel 8-bit unsigned packed CFA grayscale Bayer pattern to 4 channel 8-bit unsigned packed RGB conversion with alpha.

Parameters

  pSrc | Source-Image Pointer.
  nSrcStep | Source-Image Line Step.
  oSrcSize | full source image width and height relative to pSrc.
  oSrcROI | rectangle specifying starting source image pixel x and y location relative to pSrc and ROI width and height.
  pDst | Destination-Image Pointer.
  nDstStep | Destination-Image Line Step.
  eGrid | enumeration value specifying bayer grid registration position at location oSrcROI.x, oSrcROI.y relative to pSrc.
  eInterpolation | MUST be NPPI_INTER_UNDEFINED
  nAlpha | constant alpha value to be written to each destination pixel
  nppStreamCtx | Application Managed Stream Context.

Returns
  Image Data Related Error Codes, ROI Related Error Codes

Copyright © 2009-2019 NVIDIA Corporation