private void startPreview() {
final Camera.Size imageSize = camera.getPreviewSize();
final QRCodeReader reader = new QRCodeReader();
camera.startCameraPreview(new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
if (!resultUpdated) {
PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(data,
imageSize.width, imageSize.height,
QR_BARCODE_ROI_LEFT, QR_BARCODE_ROI_TOP,
QR_BARCODE_ROI_WIDTH, QR_BARCODE_ROI_HEIGHT, false);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result = reader.decode(bitmap); // This works
but I am not sure how to do the same if the image is a plain 8-bit bmp grayscale. Meaning the image would be:
Image = Width*Height*BYTE
where a BYTE is a simple gray scale of the pixel varying from 0 to 255
Can someone point me out on how this can be done?
thank you.