當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。