當前位置: 首頁>>代碼示例>>Java>>正文


Java Camera.PictureCallback方法代碼示例

本文整理匯總了Java中android.hardware.Camera.PictureCallback方法的典型用法代碼示例。如果您正苦於以下問題:Java Camera.PictureCallback方法的具體用法?Java Camera.PictureCallback怎麽用?Java Camera.PictureCallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.hardware.Camera的用法示例。


在下文中一共展示了Camera.PictureCallback方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: takePhoto

import android.hardware.Camera; //導入方法依賴的package包/類
public void takePhoto(){
    Camera.ShutterCallback shutterCallback = new Camera.ShutterCallback() {
        public void onShutter() {
            Log.d(TAG, "onShutter: ");
        }
    };

    Camera.PictureCallback jpegCallback = new Camera.PictureCallback() {
        public void onPictureTaken(final byte[] data, final Camera camera) {
            camera.startPreview();
            Log.d(TAG, "onPictureTaken: ");
            pictureTakenCallBack.saveAsBitmap(data);
        }
    };

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        camera.enableShutterSound(false);
    }

    camera.takePicture(shutterCallback, null, jpegCallback);
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:22,代碼來源:CameraEngine.java

示例2: takePicture

import android.hardware.Camera; //導入方法依賴的package包/類
public void takePicture( Camera.PictureCallback jpeg){
	try{
		camera.takePicture(null, null, jpeg);
	}catch (RuntimeException e){
		Toast.makeText(context, "請等待", Toast.LENGTH_LONG).show();
	}
}
 
開發者ID:MarukoZ,項目名稱:FaceRecognition,代碼行數:8,代碼來源:CameraInterface.java

示例3: savePicture

import android.hardware.Camera; //導入方法依賴的package包/類
private boolean savePicture(){
    Camera.PictureCallback picture=cameraInitializer.getPicture();
    if(picture!=null){
        cameraInitializer.getCamera().takePicture(null, null, cameraInitializer.getPicture());
        return true;
    }
    else{
        return false;
    }
}
 
開發者ID:PawelTypiak,項目名稱:Checkerboard-IMU-Comparator,代碼行數:11,代碼來源:MainActivity.java

示例4: takePictureWithAutoFocus

import android.hardware.Camera; //導入方法依賴的package包/類
private void takePictureWithAutoFocus(final android.hardware.Camera mCamera, final Camera.PictureCallback mCall) {
    final Handler uiThreadHandler = new Handler();
    if (mCamera.getParameters().getFocusMode().equals(Camera.Parameters.FOCUS_MODE_AUTO)) {
        mCamera.autoFocus(new Camera.AutoFocusCallback() {
            @Override
            public void onAutoFocus(boolean success, Camera camera) {
                uiThreadHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        mCamera.takePicture(new Camera.ShutterCallback() {
                            @Override
                            public void onShutter() {
                                mCamera.cancelAutoFocus();
                            }
                        }, null, mCall);
                    }
                }, 500);
            }
        });
    } else {
        uiThreadHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                mCamera.takePicture(null, null, mCall);
            }
        }, 500);
    }
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:29,代碼來源:CameraHeadService.java

示例5: run_camera

import android.hardware.Camera; //導入方法依賴的package包/類
public void run_camera(Context context, Camera.PictureCallback callback) {

        if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
            Log.d("ERROR", "NO CAMERA");
        } else {
            safeCameraOpen(defaultCameraId);
        }

        SmartCamera.setCameraDisplayOrientation((Activity) context, defaultCameraId, camera);

        SurfaceTexture surfaceTexture = new SurfaceTexture(0);


        try {
            camera.setPreviewTexture(surfaceTexture);

            Camera.Parameters params = camera.getParameters();
            params.setJpegQuality(100);
            //params.set
            camera.setParameters(params);
            camera.startPreview();

            camera.takePicture(null, null, callback);
        } catch (
                Exception ex)

        {
            Log.d("ERROR", ex.toString());

        }

    }
 
開發者ID:dazcode,項目名稱:smart-device-cloud,代碼行數:33,代碼來源:SmartCamera.java

示例6: rawCallbackOrNull

import android.hardware.Camera; //導入方法依賴的package包/類
private Camera.PictureCallback rawCallbackOrNull(final EasyCamera.PictureCallback callback) {
    if (callback != null) {
        return new Camera.PictureCallback() {
            @Override
            public void onPictureTaken(byte[] data, Camera camera) {
                callback.onPictureTaken(data, DefaultCameraActions.this); //TODO is this the right CameraActions?
            }
        };
    }
    return null;
}
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:12,代碼來源:DefaultCameraActions.java

示例7: getPicture

import android.hardware.Camera; //導入方法依賴的package包/類
public Camera.PictureCallback getPicture() {
    return Picture;
}
 
開發者ID:PawelTypiak,項目名稱:Checkerboard-IMU-Comparator,代碼行數:4,代碼來源:CameraInitializer.java

示例8: takePicture

import android.hardware.Camera; //導入方法依賴的package包/類
public static void takePicture(Camera.ShutterCallback shutterCallback, Camera.PictureCallback rawCallback, 
		Camera.PictureCallback jpegCallback){
	mCamera.takePicture(shutterCallback, rawCallback, jpegCallback);
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:5,代碼來源:CameraEngine.java

示例9: takePicture

import android.hardware.Camera; //導入方法依賴的package包/類
public void takePicture(Camera.ShutterCallback shutter, Camera.PictureCallback raw,
        Camera.PictureCallback jpeg) {
    if (mCamera != null) {
        mCamera.takePicture(shutter, raw, jpeg);
    }
}
 
開發者ID:hoanganhtuan95ptit,項目名稱:EditPhoto,代碼行數:7,代碼來源:CameraController.java

示例10: takeShot

import android.hardware.Camera; //導入方法依賴的package包/類
public void takeShot(Camera.ShutterCallback shutterCallback,
                     Camera.PictureCallback rawPictureCallback,
                     Camera.PictureCallback jpegPictureCallback ){

    mCamera.takePicture(shutterCallback, rawPictureCallback, jpegPictureCallback);
}
 
開發者ID:simplezhli,項目名稱:Tesseract-OCR-Scanner,代碼行數:7,代碼來源:CameraManager.java


注:本文中的android.hardware.Camera.PictureCallback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。