C# Class ZXing.PlanarYUVLuminanceSource

This object extends LuminanceSource around an array of YUV data returned from the camera driver, with the option to crop to a rectangle within the full data. This can be used to exclude superfluous pixels around the perimeter and speed up decoding. It works for any pixel format where the Y channel is planar and appears first, including YCbCr_420_SP and YCbCr_422_SP. @author [email protected] (Daniel Switkin)
Inheritance: ZXing.BaseLuminanceSource
Show file Open project: Redth/ZXing.Net.Mobile Class Usage Examples

Public Methods

Method Description
PlanarYUVLuminanceSource ( byte yuvData, int dataWidth, int dataHeight, int left, int top, int width, int height, bool reverseHoriz ) : System

Initializes a new instance of the PlanarYUVLuminanceSource class.

crop ( int left, int top, int width, int height ) : ZXing.LuminanceSource

Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if CropSupported is true.

getRow ( int y, byte row ) : byte[]

Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called.

renderThumbnail ( ) : int[]

Renders the cropped greyscale bitmap.

Protected Methods

Method Description
CreateLuminanceSource ( byte newLuminances, int width, int height ) : ZXing.LuminanceSource

Private Methods

Method Description
PlanarYUVLuminanceSource ( byte luminances, int width, int height ) : System

Initializes a new instance of the PlanarYUVLuminanceSource class.

reverseHorizontal ( int width, int height ) : void

Method Details

CreateLuminanceSource() protected method

protected CreateLuminanceSource ( byte newLuminances, int width, int height ) : ZXing.LuminanceSource
newLuminances byte
width int
height int
return ZXing.LuminanceSource

PlanarYUVLuminanceSource() public method

Initializes a new instance of the PlanarYUVLuminanceSource class.
public PlanarYUVLuminanceSource ( byte yuvData, int dataWidth, int dataHeight, int left, int top, int width, int height, bool reverseHoriz ) : System
yuvData byte The yuv data.
dataWidth int Width of the data.
dataHeight int Height of the data.
left int The left.
top int The top.
width int The width.
height int The height.
reverseHoriz bool if set to true [reverse horiz].
return System

crop() public method

Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if CropSupported is true.
public crop ( int left, int top, int width, int height ) : ZXing.LuminanceSource
left int The left coordinate, 0 <= left < Width.
top int The top coordinate, 0 <= top <= Height.
width int The width of the rectangle to crop.
height int The height of the rectangle to crop.
return ZXing.LuminanceSource

getRow() public method

Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called.
public getRow ( int y, byte row ) : byte[]
y int The row to fetch, 0 <= y < Height.
row byte An optional preallocated array. If null or too small, it will be ignored. /// Always use the returned object, and ignore the .length of the array.
return byte[]

renderThumbnail() public method

Renders the cropped greyscale bitmap.
public renderThumbnail ( ) : int[]
return int[]