0

I am trying to detect qr codes with the sony smarteyeglass

When I use CAMERA_MODE_STILL i can capture a picture and detect the barcode in it works fine!

Now when I change the recording mode to CAMERA_MODE_JPG_STREAM_LOW_RATE

I have to set the resolution to CAMERA_RESOLUTION_QVGA else setCameraMode is throwing "resolution has illegal value" because in SmartEyeglassControlUtils Stream support only contains QVGA

private static final List<Integer> CAMERA_JPEG_STREAM_SUPPORT_RESOLUTION = Arrays.asList(
            SmartEyeglassControl.Intents.CAMERA_RESOLUTION_QVGA
);

I already tried modifying that but then the camera is not working anymore.

So how would I detect a QR code without having to actually snap a picture and send it to the zxing Library? is there a way to increase quality and still use the stream? or do I have to use Stillmode and actually capture pictures so I can use 3M resolution?

stackg91
  • 584
  • 7
  • 25

1 Answers1

0

Sorry for the late reply. You should be able to use the CAMERA_MODE_JPG_STREAM_LOW_RATE option and capture the images you need frame by frame and send them to zing. If you start from the SampleCameraControl sample and open the "SampleCameraControl.java" file then you can modify the listener in the SampleCameraControl constructor like this:

    // Initialize listener for camera events
    SmartEyeglassEventListener listener = new SmartEyeglassEventListener() {
        // When camera operation has succeeded
        // handle result according to current recording mode
        @Override
        public void onCameraReceived(final CameraEvent event) {

            /*
             * Turn over full control of the streamed video to the barcode scanner library
             * */
          byte[] bitmapdata = event.getData();

          //Convert the camera data to a bitmap
          Bitmap originalBitmap = BitmapFactory.decodeByteArray(bitmapdata, 0, bitmapdata.length);

          //Create a blank bitmap canvas so we can draw text
          Bitmap mainBitMap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888);      
          Canvas mainCanvas = new Canvas(mainBitMap);

          //Add the main bitmap to the new blank canvas
          mainCanvas.drawBitmap(originalBitmap, 0, 0, new Paint());

          mainCanvas = drawScanText(mainCanvas, "Scan:null");

          //Scan the barcode with Zxing
          scanBarcodeTask = new scanBarcodeTask().execute(originalBitmap);

        }
        // Called when camera operation has failed
        // We just log the error
        @Override
        public void onCameraErrorReceived(final int error) {
            Log.d(Constants.LOG_TAG, "onCameraErrorReceived: " + error);
        }
        // When camera is set to record image to a file,
        // log the operation and clean up
        @Override
        public void onCameraReceivedFile(final String filePath) {
            Log.d(Constants.LOG_TAG, "onCameraReceivedFile: " + filePath);
            mode.closeCamera(utils);
        }
    };
pg316
  • 1,380
  • 1
  • 8
  • 7