当前位置: 首页>>代码示例>>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;未经允许,请勿转载。