namespace referencePiiCamera
Camera-related utility functions and definitions.
Classes
| struct |
A structure used for handling different Bayer encoding schemes with bayerToRgb(). |
| struct |
Bayer decoding structure for BGGR color ordering. |
| struct |
A Bayer decoding functor that extracts the blue channel only. |
| struct |
An interpolation functor that always returns the value of the center of a neighborhood without interpolation. |
| struct |
An interpolation functor that calculates the value of a color channel by averaging the four diagonal neighbors of a pixel. |
| struct |
A Bayer decoding functor that directly converts the image to gray levels by averaging RGB channels. |
| struct |
Bayer decoding structure for GRBG color ordering. |
| struct |
A Bayer decoding functor that extracts the green channel only. |
| struct |
An interpolation functor that calculates the value of a color channel by averaging the two horizontal neighbors of a pixel. |
| struct |
An interpolation functor that does nothing. |
| struct |
A Bayer decoding functor that extracts the red channel only. |
| struct |
Four-channel rgb color pixel type functor for Bayer decoding. |
| struct |
Rgb color pixel type functor for Bayer decoding. |
| struct |
Bayer decoding structure for RGGB color ordering. |
| struct |
An interpolation functor that calculates the value of a color channel by averaging the four straight neighbors of a pixel. |
| struct |
An interpolation functor that calculates the value of a color channel by averaging the two vertical neighbors of a pixel. |
Enumerations
|
enum
|
{ AreaScan = 0, LineScan }
Supported camera types. |
|
enum
|
{ InvalidFormat = 0, MonoFormat = 1, BayerRGGBFormat,
BayerBGGRFormat, BayerGBRGFormat, BayerGRBGFormat, RgbFormat = 16,
BgrFormat }
Supported image formats. |
Functions
|
template<class T, class Decoder, class Pixel>
PiiMatrix< typename
Pixel::Type >
|
Convert a Bayer-encoded color image to RGB colors. |
|
A convenience function that decodes a GRBG-encoded 8-bit image into a 32-bit RGB color image. |
|
|
A convenience function that decodes an RGGB-encoded 8-bit image into a 32-bit RGB color image. |
Enumeration details
-
enum CameraType
Supported camera types.
-
AreaScan- the camera type is area scan. -
LineScan- the camera type is line scan.
-
-
enum ImageFormat
Supported image formats.
-
InvalidFormat- the image format is unrecognized or not yet known. -
MonoFormat- the image is monochrome (gray-scale) -
BayerRGGBFormat- the image is Bayer-encoded in BGGR color order. -
BayerGBRGFormat- the image is Bayer-encoded in GBRG color order. -
BayerGRBGFormat- the image is Bayer-encoded in GRBG color order. -
RgbFormat- the image is in RGB format -
BgrFormat- the image is in BGR format.
-
Function details
-
template<class T, class Decoder, class Pixel>
PiiMatrix< typename Pixel::Type > bayerToRgb
#include <PiiBayerConverter.h>Convert a Bayer-encoded color image to RGB colors.
Use the BayerConversionTraits structure to control the way colors are interpolated.
PiiMatrix<unsigned char> encoded; // Convert to four-channel RGB PiiMatrix<PiiColor4<> > rgbImage = PiiCamera::bayerToRgb(encoded, PiiCamera::RggbDecoder<>(), PiiCamera::RgbPixel<>()); // Take only blue channel, as an integer PiiMatrix<int> blueChannel = PiiCamera::bayerToRgb(encoded, PiiCamera::RggbDecoder<>(), PiiCamera::BluePixel<int>()); // Convert directly to gray levels PiiMatrix<int> gray = PiiCamera::bayerToRgb(encoded, PiiCamera::RggbDecoder<>(), PiiCamera::GrayPixel<int>());
See the documentation of RgbPixel on how to create your own pixel types.
Parameters
- encoded
-
a Bayer-encoded color image
- decoder
-
a decoder object used for interpolating color channels. The template type of the decoder must match that of the input matrix.
- pixel
-
a functor that converts the interpolated values into output values. By changing the pixel functor one can change the output type to virtually anything. Implementations for RgbPixel, Rgb4Pixel, RedPixel, GreenPixel, and BluePixel are provided.
Returns
decoded color image. The size of this image equals that of
encoded. If the input matrix is smaller than 2x2, no conversion will be done. -
#include <PiiBayerConverter.h>A convenience function that decodes a GRBG-encoded 8-bit image into a 32-bit RGB color image.
-
#include <PiiBayerConverter.h>A convenience function that decodes an RGGB-encoded 8-bit image into a 32-bit RGB color image.
Add a note
Not a single note added yet. Be the first, add yours.