Table of Contents

Class PlanarYUVLuminanceSource

Namespace
ZXing
Assembly
zxing.dll

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 dswitkin@google.com (Daniel Switkin)

public sealed class PlanarYUVLuminanceSource : BaseLuminanceSource
Inheritance
PlanarYUVLuminanceSource
Inherited Members

Constructors

PlanarYUVLuminanceSource(byte[], int, int, int, int, int, int, bool)

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)

Parameters

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].

Properties

CropSupported

public override bool CropSupported { get; }

Property Value

bool

Whether this subclass supports cropping.

Matrix

public override byte[] Matrix { get; }

Property Value

byte[]

ThumbnailHeight

height of image from {@link #renderThumbnail()}

public int ThumbnailHeight { get; }

Property Value

int

ThumbnailWidth

width of image from {@link #renderThumbnail()}

public int ThumbnailWidth { get; }

Property Value

int

Methods

CreateLuminanceSource(byte[], int, int)

creates a new instance

protected override LuminanceSource CreateLuminanceSource(byte[] newLuminances, int width, int height)

Parameters

newLuminances byte[]
width int
height int

Returns

LuminanceSource

crop(int, int, int, int)

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 override LuminanceSource crop(int left, int top, int width, int height)

Parameters

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.

Returns

LuminanceSource

A cropped version of this object.

getRow(int, 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.

public override byte[] getRow(int y, byte[] row)

Parameters

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.

Returns

byte[]

An array containing the luminance data.

renderThumbnail()

Renders the cropped greyscale bitmap.

public int[] renderThumbnail()

Returns

int[]