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


Java CameraAccessException.printStackTrace方法代码示例

本文整理汇总了Java中android.hardware.camera2.CameraAccessException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java CameraAccessException.printStackTrace方法的具体用法?Java CameraAccessException.printStackTrace怎么用?Java CameraAccessException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.hardware.camera2.CameraAccessException的用法示例。


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

示例1: closeCamera

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
@TargetApi(23)
@Override
public void closeCamera() {

    textureView.setVisibility(View.GONE);

    if (mDetectTimer != null) {
        mDetectTimer.cancel();
    }
    if (cameraCaptureSession != null && isDetecting) {
        try {
            cameraCaptureSession.abortCaptures();
            cameraCaptureSession.stopRepeating();
            cameraCaptureSession.close();
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
    if (cameraDevice != null) {
        cameraDevice.close();
    }
}
 
开发者ID:lazyparser,项目名称:xbot_head,代码行数:23,代码来源:SignInFragment.java

示例2: openCamera

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
private void openCamera(String cameraId) {
        try {
//            CameraCharacteristics characteristics = mCameraManager.getCameraCharacteristics(cameraId);
//            characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
            if (ActivityCompat.checkSelfPermission(getContext(), permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
                // TODO: Consider calling
                //    ActivityCompat#requestPermissions
                // here to request the missing permissions, and then overriding
                //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                //                                          int[] grantResults)
                // to handle the case where the user grants the permission. See the documentation
                // for ActivityCompat#requestPermissions for more details.
                return;
            }
            setUpCameraOutputs(cameraId, ttv_camera.getWidth(), ttv_camera.getHeight());
            configureTransform(ttv_camera.getWidth(), ttv_camera.getHeight());
            mCameraManager.openCamera(cameraId, mCameraDeviceStateCallback, mHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:vipycm,项目名称:mao-android,代码行数:22,代码来源:Camera2Fragment.java

示例3: createCameraPreviewSession

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
private void createCameraPreviewSession() {
        if (mCamera == null) {
            return;
        }


        SurfaceHolder holder = surfaceView.getHolder();
//        if (config != null) {
//            holder.setFixedSize(640, 480);
//        }
        Surface surface = holder.getSurface();


        List<Surface> surfaceList = Arrays.asList(surface, mImageReader.getSurface());

        try {
            mPreviewBuilder = mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
            mPreviewBuilder.addTarget(surface);

            mCamera.createCaptureSession(surfaceList, sessionCallback, mHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:ThinkKeep,项目名称:EvilsLive,代码行数:25,代码来源:CameraNew.java

示例4: startPreview

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
private void startPreview() {
    try {
        CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(cameraId);
        StreamConfigurationMap configMap = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);

        Size previewSize = Util.getPreferredPreviewSize(
                configMap.getOutputSizes(ImageFormat.JPEG),textureView.getWidth(), textureView.getHeight());

        surfaceTexture.setDefaultBufferSize(previewSize.getWidth(),previewSize.getHeight());
        Surface surface = new Surface(surfaceTexture);
        captureBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
        captureBuilder.addTarget(surface);

        cameraDevice.createCaptureSession(Arrays.asList(surface),captureSessionCallback,backgroundHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:lazyparser,项目名称:xbot_head,代码行数:19,代码来源:CommentaryFragment.java

示例5: unlockFocus

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
/**
 * Unlock the focus. This method should be called when still image capture sequence is
 * finished.
 */
private void unlockFocus() {
    try {
        // Reset the auto-focus trigger
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
                CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
        setAutoFlash(mPreviewRequestBuilder);
        mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
                mBackgroundHandler);
        // After this, the camera will go back to the normal state of preview.
        mState = STATE_PREVIEW;
        mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback,
                mBackgroundHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:wingskyer,项目名称:android-Camera2Basic-master,代码行数:21,代码来源:Camera2BasicFragment.java

示例6: openCamera

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
/**
     * 相机开启
     * @param width     TextureView的宽度
     * @param height    TextureView的高度
     */
    private void openCamera(int width, int height) {

        if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
                != PackageManager.PERMISSION_GRANTED) {
//            requestCameraPermission();
            return;
        }
        setUpCameraOutputs(width, height);
        configureTransform(width, height);
        try {
            cameraManager.openCamera(cameraID, deviceStateCallback, mainHandler);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:hgs1217,项目名称:Paper-Melody,代码行数:21,代码来源:CalibrationActivity.java

示例7: lockFocus

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
/**
 * Lock the focus as the first step for a still image capture.
 */
private void lockFocus() {
    try {
        // This is how to tell the camera to lock focus.
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
                CameraMetadata.CONTROL_AF_TRIGGER_START);
        // Tell #mCaptureCallback to wait for the lock.
        mState = STATE_WAITING_LOCK;
        mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
                mBackgroundHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:17,代码来源:Camera2BasicFragment.java

示例8: buildRequest

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
@Override
public void buildRequest(int type) {
    try {
        CaptureRequest.Builder builder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }

}
 
开发者ID:OkayCamera,项目名称:OkayCamera-Android,代码行数:10,代码来源:CaptureModel.java

示例9: runPrecaptureSequence

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
/**
 * Run the precapture sequence for capturing a still image. This method should be called when
 * we get a response in {@link #mCaptureCallback} from {@link #lockFocus()}.
 */
private void runPrecaptureSequence() {
    try {
        // This is how to tell the camera to trigger.
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
        // Tell #mCaptureCallback to wait for the precapture sequence to be set.
        mState = STATE_WAITING_PRECAPTURE;
        mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, mBackgroundHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:EzequielAdrianM,项目名称:Camera2Vision,代码行数:16,代码来源:Camera2Source.java

示例10: updatePreview

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
/**
 * Update the camera preview. {@link #startPreview()} needs to be called in advance.
 */
private void updatePreview() {
    if (null == mCameraDevice) {
        return;
    }
    try {
        setUpCaptureRequestBuilder(mPreviewBuilder);
        HandlerThread thread = new HandlerThread("CameraPreview");
        thread.start();
        mPreviewSession.setRepeatingRequest(mPreviewBuilder.build(), null, mBackgroundHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:mywitness,项目名称:Camara2-Video-Demo-fixed,代码行数:17,代码来源:Camera2VideoFragment.java

示例11: takePicture

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
private void takePicture() {
    if (mCameraDevice == null) {
        return;
    }

    //创建Request.Builder()
    final CaptureRequest.Builder requestBuilder ;
    try{
        requestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);

        //将ImageReader的surface作为CaptureRequest.Builder的目标
        requestBuilder.addTarget(mImageReader.getSurface());
        // 自动对焦
        requestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        // 自动曝光
        requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);

        requestBuilder.set(CaptureRequest.JPEG_ORIENTATION, 270);

        //拍照
        CaptureRequest mCaptureRequest = requestBuilder.build();
        mCameraCaptureSession.capture(mCaptureRequest, null, null);

    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:lazyparser,项目名称:xbot_head,代码行数:28,代码来源:CameraActivity.java

示例12: runPrecaptureSequence

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
private void runPrecaptureSequence() {
    MLog.d(TAG, "runPrecaptureSequence");

    try {
        // This is how to tell the camera to trigger.
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
        // Tell #mCaptureCallback to wait for the precapture sequence to be set.
        mState = STATE_WAITING_PRECAPTURE;
        mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:14,代码来源:CameraNew2.java

示例13: unlockFocus

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
private void unlockFocus() {
    MLog.d(TAG, "unlockFocus");

    try {
        // Reset the auto-focus trigger
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
        //setAutoFlash(mPreviewRequestBuilder);
        mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback, null);
        // After this, the camera will go back to the normal state of preview.
        mState = STATE_PREVIEW;
        mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, null);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:16,代码来源:CameraNew2.java

示例14: runPrecaptureSequence

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
/**
 * Run the precapture sequence for capturing a still image. This method should be called when
 * we get a response in {@link #mCaptureCallback} from {@link #lockFocus()}.
 */
private void runPrecaptureSequence() {
    try {
        // This is how to tell the camera to trigger.
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,
                CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
        // Tell #mCaptureCallback to wait for the precapture sequence to be set.
        mState = STATE_WAITING_PRECAPTURE;
        mCaptureSession.capture(mPreviewRequestBuilder.build(), mCaptureCallback,
                mBackgroundHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:TongLi1992,项目名称:Camera_Calibration_Android,代码行数:18,代码来源:Camera2BasicFragment.java

示例15: onConfigured

import android.hardware.camera2.CameraAccessException; //导入方法依赖的package包/类
@Override
public void onConfigured(CameraCaptureSession session) {
    mCameraCaptureSession = session;
    try {
        // 自动对焦
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
        // 自动闪光灯
        mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
        CaptureRequest previewRequest = mPreviewRequestBuilder.build();
        session.setRepeatingRequest(previewRequest, null, mPreviewHandler);
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:15,代码来源:Camera2Input.java


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