本文整理匯總了Java中android.hardware.camera2.CameraDevice.createCaptureRequest方法的典型用法代碼示例。如果您正苦於以下問題:Java CameraDevice.createCaptureRequest方法的具體用法?Java CameraDevice.createCaptureRequest怎麽用?Java CameraDevice.createCaptureRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.hardware.camera2.CameraDevice
的用法示例。
在下文中一共展示了CameraDevice.createCaptureRequest方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupCaptureRequestForPreview
import android.hardware.camera2.CameraDevice; //導入方法依賴的package包/類
/**
* does setup the repeating capture request for taking images for the preview
*/
@VisibleForTesting
void setupCaptureRequestForPreview(@NonNull CameraCaptureSession previewSession, @NonNull CameraDevice camera,
@NonNull List<Surface> surfaces) {
try {
CaptureRequest.Builder previewRequestBuilder = camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
for (Surface surface : surfaces) {
previewRequestBuilder.addTarget(surface);
}
previewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
previewSession.setRepeatingRequest(previewRequestBuilder.build(), null, null);
} catch (CameraAccessException | IllegalStateException e) {
throw new CameraException(e);
}
}
示例2: createCaptureRequest
import android.hardware.camera2.CameraDevice; //導入方法依賴的package包/類
/**
* Get a request builder for the current camera.
*/
public CaptureRequest.Builder createCaptureRequest(int template) throws CameraAccessException {
CameraDevice device = mCameraDevice;
if (device == null) {
throw new IllegalStateException("Can't get requests when no camera is open");
}
return device.createCaptureRequest(template);
}
示例3: onOpened
import android.hardware.camera2.CameraDevice; //導入方法依賴的package包/類
@Override
public void onOpened(CameraDevice cameraDevice) {
Log.d(TAG, "相機已經打開");
try {
mPreViewBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
SurfaceTexture texture = mTextureView.getSurfaceTexture();
texture.setDefaultBufferSize(mPreViewSize.getWidth(), mPreViewSize.getHeight());
surface = new Surface(texture);
mPreViewBuilder.addTarget(surface);
cameraDevice.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface
()), mSessionStateCallBack, mHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}