|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.zxing.common.BaseMonochromeBitmapSource
com.google.zxing.client.android.YUVMonochromeBitmapSource
public final class YUVMonochromeBitmapSource
This object implements MonochromeBitmapSource around an array of YUV data, giving you 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.
Constructor Summary | |
---|---|
YUVMonochromeBitmapSource(byte[] yuvData,
int dataWidth,
int dataHeight)
Builds an object around a YUV buffer from the camera. |
|
YUVMonochromeBitmapSource(byte[] yuvData,
int dataWidth,
int dataHeight,
int cropTop,
int cropLeft,
int cropBottom,
int cropRight)
Builds an object around a YUV buffer from the camera. |
|
YUVMonochromeBitmapSource(byte[] yuvData,
int dataWidth,
int dataHeight,
android.graphics.Rect crop)
Builds an object around a YUV buffer from the camera. |
Method Summary | |
---|---|
int |
getLuminance(int x,
int y)
The Y channel is stored as planar data at the head of the array, so we just ignore the interleaved U and V which follow it. |
int[] |
getLuminanceColumn(int x,
int[] column)
The same as getLuminanceRow(), but for columns. |
int[] |
getLuminanceRow(int y,
int[] row)
This is the main mechanism for retrieving luminance data. |
android.graphics.Bitmap |
renderToBitmap()
Create a greyscale Android Bitmap from the YUV data based on the crop rectangle. |
Methods inherited from class com.google.zxing.common.BaseMonochromeBitmapSource |
---|
estimateBlackPoint, getBlackColumn, getBlackDiagonal, getBlackRow, getHeight, getLastEstimationMethod, getWidth, isBlack, isRotateSupported, rotateCounterClockwise, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public YUVMonochromeBitmapSource(byte[] yuvData, int dataWidth, int dataHeight)
yuvData
- A byte array of planar Y data, followed by interleaved U and VdataWidth
- The width of the Y datadataHeight
- The height of the Y datapublic YUVMonochromeBitmapSource(byte[] yuvData, int dataWidth, int dataHeight, android.graphics.Rect crop)
yuvData
- A byte array of planar Y data, followed by interleaved U and VdataWidth
- The width of the Y datadataHeight
- The height of the Y datacrop
- The rectangle within the yuvData to expose to MonochromeBitmapSource userspublic YUVMonochromeBitmapSource(byte[] yuvData, int dataWidth, int dataHeight, int cropTop, int cropLeft, int cropBottom, int cropRight)
yuvData
- A byte array of planar Y data, followed by interleaved U and VdataWidth
- The width of the Y datadataHeight
- The height of the Y datacropTop
- Top coordinate of rectangle to cropcropLeft
- Left coordinate of rectangle to cropcropBottom
- Bottom coordinate of rectangle to cropcropRight
- Right coordinate of rectangle to cropMethod Detail |
---|
public int getLuminance(int x, int y)
getLuminance
in interface MonochromeBitmapSource
getLuminance
in class BaseMonochromeBitmapSource
x
- The x coordinate to fetch within cropy
- The y coordinate to fetch within crop
public int[] getLuminanceRow(int y, int[] row)
BaseMonochromeBitmapSource
getLuminanceRow
in interface MonochromeBitmapSource
getLuminanceRow
in class BaseMonochromeBitmapSource
y
- The row to fetchrow
- The array to write luminance values into. It is strongly suggested that you
allocate this yourself, making sure row.length >= getWidth(), and reuse the same
array on subsequent calls for performance. If you pass null, you will be flogged,
but then I will take pity on you and allocate a sufficient array internally.
public int[] getLuminanceColumn(int x, int[] column)
BaseMonochromeBitmapSource
getLuminanceColumn
in interface MonochromeBitmapSource
getLuminanceColumn
in class BaseMonochromeBitmapSource
x
- The column to fetchcolumn
- The array to write luminance values into. See above.
public android.graphics.Bitmap renderToBitmap()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |