Sony SmartEyeglass用JPEG流检测QR码



我正在尝试使用Sony SmartEyeglass检测QR码

当我使用CAMERA_MODE_STILL时,我可以捕获图片并检测到它的条形码工作正常!

现在,当我将录制模式更改为CAMERA_MODE_JPG_STREAM_LOW_RATE

我必须将分辨率设置为CAMERA_RESOLUTION_QVGA,否则setCameraMode投掷"分辨率具有非法值",因为在SmartEyeglassControlUtils流支持中仅包含QVGA

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

我已经尝试修改它,但是相机不再工作了。

那么,如何在不必实际拍摄图片并将其发送到ZXing库的情况下检测QR码?有没有办法提高质量并仍然使用流?还是我必须使用Stillmode并实际捕获图片,以便我可以使用3M分辨率?

对不起,回复了。您应该能够使用camera_mode_jpg_stream_low_rate选项并捕获您需要的图像并将其发送到Zing。如果您从SampleCameracontrol样品开始并打开" SampleCameracontrol.java"文件,则可以在SampleCameracontrol构造函数中修改侦听器,例如:

    // 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);
        }
    };

最新更新