+ /**
+ * Builds an object around a YUV buffer from the camera. The image is cropped and only
+ * that part of the image is evaluated.
+ *
+ * @param yuvData A byte array of planar Y data, followed by interleaved U and V
+ * @param dataWidth The width of the Y data
+ * @param dataHeight The height of the Y data
+ * @param cropTop Top coordinate of rectangle to crop
+ * @param cropLeft Left coordinate of rectangle to crop
+ * @param cropBottom Bottom coordinate of rectangle to crop
+ * @param cropRight Right coordinate of rectangle to crop
+ */
+ public YUVMonochromeBitmapSource(byte[] yuvData,
+ int dataWidth,
+ int dataHeight,
+ int cropTop,
+ int cropLeft,
+ int cropBottom,
+ int cropRight) {
+ super(cropRight - cropLeft, cropBottom - cropTop);
+ if (cropRight - cropLeft > dataWidth || cropBottom - cropTop > dataHeight) {
+ throw new IllegalArgumentException();
+ }
+ mYUVData = yuvData;
+ mDataWidth = dataWidth;
+ this.mCropTop = cropTop;
+ this.mCropLeft = cropLeft;