这么晚才回复很抱歉。您应该能够使用 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);
}
};