当前位置: 首页>>代码示例>>Java>>正文


Java TotalCaptureResult类代码示例

本文整理汇总了Java中android.hardware.camera2.TotalCaptureResult的典型用法代码示例。如果您正苦于以下问题:Java TotalCaptureResult类的具体用法?Java TotalCaptureResult怎么用?Java TotalCaptureResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TotalCaptureResult类属于android.hardware.camera2包,在下文中一共展示了TotalCaptureResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
    if(request.getTag() == ("FOCUS_TAG")) {
        //The focus trigger is complete!
        //Resume repeating request, clear AF trigger.
        mAutoFocusCallback.onAutoFocus(true);
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, null);
        mPreviewRequestBuilder.setTag("");
        mPreviewRequest = mPreviewRequestBuilder.build();
        try {
            mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);
        } catch(CameraAccessException ex) {
            Log.d(TAG, "AUTO FOCUS FAILURE: "+ex);
        }
    } else {
        process(result);
    }
}
 
开发者ID:EzequielAdrianM,项目名称:Camera2Vision,代码行数:19,代码来源:Camera2Source.java

示例2: captureStillPicture

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
void captureStillPicture() {
    deviceOrientationListener.rememberOrientation();
    try {
        CaptureRequest.Builder picCaptureRequestBuilder = cameraDevice.createCaptureRequest(CameraDevice
                .TEMPLATE_STILL_CAPTURE);
        picCaptureRequestBuilder.addTarget(imageReader.getSurface());
        picCaptureRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                previewRequestBuilder.get(CaptureRequest.CONTROL_AF_MODE));
        // fix the orientation
        picCaptureRequestBuilder.set(CaptureRequest.JPEG_ORIENTATION, getJpegOrientation(cameraCharacteristics));
        captureSession.stopRepeating(); // Stop preview while capturing a still picture.
        captureSession.capture(picCaptureRequestBuilder.build(), new CameraCaptureSession.CaptureCallback() {
            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                restartPreview(); // restart the preview etc.
            }
        }, null);

    } catch (CameraAccessException e) {
        Log.e(TAG, "Cannot capture a still picture.", e);
    }
}
 
开发者ID:spinaki,项目名称:android-camera,代码行数:24,代码来源:Camera2.java

示例3: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(CameraCaptureSession session,
                               CaptureRequest request, TotalCaptureResult result) {

    super.onCaptureCompleted(session, request, result);
    //new tell the system that the file exists , so it will show up in gallery/photos/whatever
    ContentValues values = new ContentValues();
    values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
    values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
    values.put(MediaStore.MediaColumns.DATA, file.toString());
    context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

    Toast.makeText(context, "Saved:" + file, Toast.LENGTH_SHORT).show();
    Log.v(TAG, "Saved:" + file);
    camera2Preview.startPreview();
}
 
开发者ID:JimSeker,项目名称:AudioVideo,代码行数:17,代码来源:Camera2CapturePic.java

示例4: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(CameraCaptureSession session,
                               CaptureRequest request, TotalCaptureResult result) {

    super.onCaptureCompleted(session, request, result);
    //new tell the system that the file exists , so it will show up in gallery/photos/whatever
    ContentValues values = new ContentValues();
    values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
    values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
    values.put(MediaStore.MediaColumns.DATA, file.toString());
    context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

    Toast.makeText(context, "Saved:" + file, Toast.LENGTH_SHORT).show();
    Log.v(TAG, "Saved:" + file);
    startPreview();
}
 
开发者ID:JimSeker,项目名称:AudioVideo,代码行数:17,代码来源:Camera2Preview.java

示例5: onImageCaptured

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onImageCaptured(Image image, TotalCaptureResult
        captureResult) {
    long timestamp = captureResult.get(CaptureResult.SENSOR_TIMESTAMP);

    // We should only capture the image if it's more recent than the
    // latest one. Synchronization is necessary since this method is
    // called on {@link #mImageSaverThreadPool}.
    synchronized (mLastCapturedImageTimestamp) {
        if (timestamp > mLastCapturedImageTimestamp.get()) {
            mLastCapturedImageTimestamp.set(timestamp);
        } else {
            // There was a more recent (or identical) image which has
            // begun being saved, so abort.
            return;
        }
    }

    mReadyStateManager.setInput(
            ReadyStateRequirement.CAPTURE_NOT_IN_PROGRESS, true);

    mSession.startEmpty();
    savePicture(image, mParams, mSession);
    mParams.callback.onPictureTaken(mSession);
    Log.v(TAG, "Image saved.  Frame number = " + captureResult.getFrameNumber());
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:27,代码来源:OneCameraZslImpl.java

示例6: captureStillPicture

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
private void captureStillPicture() {
    try {
        if (null == cameraDevice) {
            return;
        }
        final CaptureRequest.Builder captureBuilder =
                cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
        captureBuilder.addTarget(imageReader.getSurface());

        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getPhotoOrientation(configurationProvider.getSensorPosition()));

        CameraCaptureSession.CaptureCallback CaptureCallback = new CameraCaptureSession.CaptureCallback() {
            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                Log.d(TAG, "onCaptureCompleted: ");
            }
        };

        captureSession.stopRepeating();
        captureSession.capture(captureBuilder.build(), CaptureCallback, null);

    } catch (CameraAccessException e) {
        Log.e(TAG, "Error during capturing picture");
    }
}
 
开发者ID:florent37,项目名称:CameraFragment,代码行数:29,代码来源:Camera2Manager.java

示例7: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Log.d(TAG, "CaptureSession closed");
}
 
开发者ID:FoxLabMakerSpace,项目名称:SIGHT-For-the-Blind,代码行数:9,代码来源:CameraHandler.java

示例8: captureStillPicture

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
/**
 * Capture a still picture. This method should be called when we get a response in
 * {@link #mCaptureCallback} from both {@link #lockFocus()}.
 */
private void captureStillPicture() {
    try {
        final Activity activity = getActivity();
        if (null == activity || null == mCameraDevice) {
            return;
        }
        // This is the CaptureRequest.Builder that we use to take a picture.
        final CaptureRequest.Builder captureBuilder =
                mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
        captureBuilder.addTarget(mImageReader.getSurface());

        // Use the same AE and AF modes as the preview.
        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        setAutoFlash(captureBuilder);

        // Orientation
        int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

        CameraCaptureSession.CaptureCallback CaptureCallback
                = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                showToast("Saved: " + mFile);
                Log.d(TAG, mFile.toString());
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:44,代码来源:Camera2BasicFragment.java

示例9: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request,
                               TotalCaptureResult result) {
    //            Log.d(TAG,"mSessionCaptureCallback, onCaptureCompleted");
    mSession = session;
    checkState(result);
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:8,代码来源:MyCamera2Fragment.java

示例10: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
  super.onCaptureCompleted(session, request, result);
  Timber.d("Capture completed.");
  this.session = null;
}
 
开发者ID:zugaldia,项目名称:android-robocar,代码行数:9,代码来源:CaptureCallback.java

示例11: captureStillPicture

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
/**
 * Capture a still picture. This method should be called when we get a response in
 * {@link #mCaptureCallback} from both {@link #lockFocus()}.
 */
private void captureStillPicture() {
    try {
        if (null == mCameraDevice) {
            return;
        }
        if(mShutterCallback != null) {
            mShutterCallback.onShutter();
        }
        // This is the CaptureRequest.Builder that we use to take a picture.
        final CaptureRequest.Builder captureBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
        captureBuilder.addTarget(mImageReaderStill.getSurface());

        // Use the same AE and AF modes as the preview.
        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE, mFocusMode);
        if(mFlashSupported) {
            captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, mFlashMode);
        }

        // Orientation
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(mDisplayOrientation));

        CameraCaptureSession.CaptureCallback CaptureCallback = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, @NonNull TotalCaptureResult result) {
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:EzequielAdrianM,项目名称:Camera2Vision,代码行数:40,代码来源:Camera2Source.java

示例12: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request,
                               TotalCaptureResult result) {
    int requestId = (int) request.getTag();
    ImageSaver.ImageSaverBuilder jpegBuilder;
    ImageSaver.ImageSaverBuilder rawBuilder;
    StringBuilder sb = new StringBuilder();

    // Look up the ImageSaverBuilder for this request and update it with the CaptureResult
    synchronized (mCameraStateLock) {
        jpegBuilder = mJpegResultQueue.get(requestId);
        rawBuilder = mRawResultQueue.get(requestId);

        if (jpegBuilder != null) {
            jpegBuilder.setResult(result);
            sb.append("Saving JPEG as: ");
            sb.append(jpegBuilder.getSaveLocation());
        }
        if (rawBuilder != null) {
            rawBuilder.setResult(result);
            if (jpegBuilder != null) sb.append(", ");
            sb.append("Saving RAW as: ");
            sb.append(rawBuilder.getSaveLocation());
        }

        // If we have all the results necessary, save the image to a file in the background.
        handleCompletionLocked(requestId, jpegBuilder, mJpegResultQueue);
        handleCompletionLocked(requestId, rawBuilder, mRawResultQueue);

        finishedCaptureLocked();
    }

    showToast(sb.toString());
}
 
开发者ID:OkayCamera,项目名称:OkayCamera-Android,代码行数:35,代码来源:Camera2RawFragment.java

示例13: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    session.close();
    mCaptureSession = null;
    Timber.d("CaptureSession closed");
}
 
开发者ID:leinardi,项目名称:androidthings-kuman-sm9,代码行数:9,代码来源:Camera.java

示例14: onCaptureCompleted

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
@Override
public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                               @NonNull CaptureRequest request,
                               @NonNull TotalCaptureResult result) {
    //noinspection ConstantConditions
    if (session != null) {
        session.close();
        mCaptureSession = null;
    }
}
 
开发者ID:kevalpatel2106,项目名称:robo-car,代码行数:11,代码来源:PiCameraDriver.java

示例15: captureStillPicture

import android.hardware.camera2.TotalCaptureResult; //导入依赖的package包/类
/**
 * Capture a still picture. This method should be called when we get a response in
 * {@link #mCaptureCallback} from both {@link #lockFocus()}.
 */
private void captureStillPicture() {
    try {
        final Activity activity = getActivity();
        if (null == activity || null == mCameraDevice) {
            return;
        }
        // This is the CaptureRequest.Builder that we use to take a picture.
        final CaptureRequest.Builder captureBuilder =
                mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
        captureBuilder.addTarget(mImageReader.getSurface());

        // Use the same AE and AF modes as the preview.
        captureBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        setAutoFlash(captureBuilder);

        // Orientation
        int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
        captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

        CameraCaptureSession.CaptureCallback CaptureCallback
                = new CameraCaptureSession.CaptureCallback() {

            @Override
            public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                           @NonNull CaptureRequest request,
                                           @NonNull TotalCaptureResult result) {
                unlockFocus();
            }
        };

        mCaptureSession.stopRepeating();
        mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:42,代码来源:Camera2BasicFragment.java


注:本文中的android.hardware.camera2.TotalCaptureResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。