2017-02-28 9 views
0

내가 함께 QR 코드를 탐지하려고으로 QR 코드를 감지 소니 smarteyeglass소니 Smarteyeglass는 JPEG 스트림

내가 CAMERA_MODE_STILL를 사용할 때 잘 작동에 난 사진을 캡처하고 바코드를 검색 할 수 있습니다! 내가 CAMERA_MODE_JPG_STREAM_LOW_RATE

에 촬영 모드를 변경할 때

는 지금은 SmartEyeglassControlUtils 스트림에 지원은 QVGA

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

포함되어 있기 때문에 "해상도가 불법 값을 가진다"던지고 다른 setCameraModeCAMERA_RESOLUTION_QVGA의 해상도를 설정해야 이미 수정을 시도했지만 카메라가 더 이상 작동하지 않습니다.

그럼 실제로 사진을 찍어서 zxing 라이브러리로 보내지 않고도 QR 코드를 감지 할 수 있습니까? 품질을 높이고 스트림을 계속 사용하는 방법이 있습니까? 또는 Stillmode를 사용해야하고 실제로 3M 해상도를 사용할 수 있도록 사진을 캡처해야합니까?

답변

0

늦게 답장을 드려 죄송합니다. 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); 
     } 
    };