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


Java Parameters.setPictureSize方法代码示例

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


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

示例1: prepare

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
public boolean prepare() {
        try {
            f = new SurfaceTexture(0);

//            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
//                f.setDefaultBufferSize(10000, 10000);
//            }
           // SurfaceHolder h = new SurfaceView(JCL_ApplicationContext.getContext()).getHolder();
            //mCamera.setPreviewDisplay(h);
            mCamera.setPreviewTexture(f);
        } catch (IOException e1) {
            Log.e("JCLCAMERA", e1.getMessage());
            return false;
        }

        Parameters params = mCamera.getParameters();
        params.setPreviewSize(width, height);
        params.setPictureSize(width, height);

        params.setJpegQuality(50);
        params.setFlashMode(Parameters.FLASH_MODE_OFF);
        params.setPictureFormat(ImageFormat.JPEG);
        mCamera.setParameters(params);
        return true;
    }
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:26,代码来源:JCL_Camera.java

示例2: startPreview

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
private void startPreview(SurfaceHolder holder) {
	try {

		Parameters params = camera.getParameters();

		if (params.getSupportedFocusModes().contains(
				Camera.Parameters.FOCUS_MODE_AUTO)) {
			params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
		}

		List<Size> previewSizes = camera.getParameters().getSupportedPreviewSizes();
		List<Size> pictureSizes = camera.getParameters().getSupportedPictureSizes();

           params.setPreviewSize(previewSizes.get(previewSizes.size()-2).width,previewSizes.get(previewSizes.size()-2).height);
		params.setPictureSize(pictureSizes.get(pictureSizes.size()-2).width,pictureSizes.get(pictureSizes.size()-2).height);
		camera.setParameters(params);

		camera.setPreviewDisplay(holder);
		camera.startPreview();

		previewConsumer.start(camera);
	} catch(IOException e) {
		Log.e(TAG, "Error starting camera preview", e);
	}
}
 
开发者ID:zom,项目名称:Zom-Android,代码行数:26,代码来源:CameraView.java

示例3: setDefaultParameters

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
private static void setDefaultParameters(){
	Parameters parameters = mCamera.getParameters();
	if (parameters.getSupportedFocusModes().contains(
               Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
           parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
       }
	Size previewSize = getLargePreviewSize();
	parameters.setPreviewSize(1280, 720);
	Size pictureSize = getLargePictureSize();
	parameters.setPictureSize(pictureSize.width, pictureSize.height);
	mCamera.setParameters(parameters);
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:13,代码来源:CameraEngine.java

示例4: setDefaultParameters

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
private static void setDefaultParameters(){
    Parameters parameters = camera.getParameters();
    if (parameters.getSupportedFocusModes().contains(
            Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
        parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
    }
    Size previewSize = CameraUtils.getLargePreviewSize(camera);
    parameters.setPreviewSize(previewSize.width, previewSize.height);
    Size pictureSize = CameraUtils.getLargePictureSize(camera);
    parameters.setPictureSize(pictureSize.width, pictureSize.height);
    parameters.setRotation(90);
    camera.setParameters(parameters);
}
 
开发者ID:zpf527,项目名称:EffectCamera,代码行数:14,代码来源:CameraEngine.java

示例5: setCameraPictureSize

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
public static boolean setCameraPictureSize(
        String candidate, List<Size> supported, Parameters parameters) {
    int index = candidate.indexOf('x');
    if (index == NOT_FOUND) return false;
    int width = Integer.parseInt(candidate.substring(0, index));
    int height = Integer.parseInt(candidate.substring(index + 1));
    for (Size size : supported) {
        if (size.width == width && size.height == height) {
            parameters.setPictureSize(width, height);
            return true;
        }
    }
    return false;
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:15,代码来源:CameraSettings.java

示例6: setCamera

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
void setCamera() {
	myCamera = getCameraInstance();

	Parameters params = myCamera.getParameters();
	List<Camera.Size> sizes = params.getSupportedPictureSizes();
	int minWidth = Integer.MAX_VALUE, minHeight = Integer.MAX_VALUE;
	for (int i = 0; i < sizes.size(); i++) {
		Log.i("PictureSize", "Supported Size: " + sizes.get(i).width
				+ " height : " + sizes.get(i).height);
		if (sizes.get(i).width < minWidth) {
			minWidth = sizes.get(i).width;
			minHeight = sizes.get(i).height;
		}
	}
	Log.i("PictureSize", "Min Size: " + minWidth + " height : " + minHeight);

	List<int[]> fpsRanges = params.getSupportedPreviewFpsRange();
	for (int i = 0; i < fpsRanges.size(); i++) {
		Log.i("Fps ranges:", String.valueOf(fpsRanges.get(i)[0] / 1000)
				+ ' ' + String.valueOf(fpsRanges.get(i)[1] / 1000));
	}

	params.setPictureSize(minWidth, minHeight);
	params.setPreviewSize(minWidth, minHeight);
	myCamera.setParameters(params);

	camHeight = myCamera.getParameters().getPreviewSize().height;
	camWidth = myCamera.getParameters().getPreviewSize().width;
	Log.i("SavedPictureSize", "Size: " + camWidth + " height : "
			+ camHeight);
	mCallbackBuf = new byte[camHeight * camWidth * 3 / 2]; // 用于previewcallback
	hbeg = (camHeight - hnum) / 2;
	wbeg = (camWidth - wnum) / 2;
	myCamera.setPreviewCallbackWithBuffer(new MyPreview());
	myCamera.addCallbackBuffer(mCallbackBuf);

	sv_hidden.removeAllViews(); // 是不是应该先清空
	myCameraSurfaceView = new MyCameraSurfaceView(getApplicationContext(),
			myCamera);

	sv_hidden.addView(myCameraSurfaceView);
	// sv_hidden.setVisibility(View.INVISIBLE);

}
 
开发者ID:thmedialab,项目名称:DataDrivenBP,代码行数:45,代码来源:BPActivity.java

示例7: openCamera

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
/**
 * 初始化摄像头
 */
private void openCamera(SurfaceView surfaceView, int width, int height) {
	if (!isPreview) {
		camera = Camera.open();
	}
	if (camera != null && !isPreview) {
		try {
			Parameters parameters = camera.getParameters();
			// 设置闪光灯为自动状态
			parameters.setFlashMode(Parameters.FLASH_MODE_AUTO);
			camera.setParameters(parameters);
			// 设置预览照片的大小
			parameters.setPreviewSize(width, height);
			// 设置每秒显示4帧
			parameters.setPreviewFrameRate(4);
			// 设置图片格式
			parameters.setPictureFormat(ImageFormat.JPEG);
			// 设置JPG照片的质量
			parameters.set("jpeg-quality", 100);
			// 设置照片大小
			parameters.setPictureSize(width, height);
			// 通过SurfaceView显示取景画面
			camera.setPreviewDisplay(surfaceView.getHolder());
			// 如果是竖屏
			if (surfaceView.getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
				camera.setDisplayOrientation(90);
			} else {
				camera.setDisplayOrientation(0);
			}
			
			// 开始预览
			camera.startPreview();
			// 自动对焦
			camera.autoFocus(null);
			
			isPreview = true;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:44,代码来源:CameraManager.java

示例8: set_picture_resolution

import android.hardware.Camera.Parameters; //导入方法依赖的package包/类
public void set_picture_resolution(Size new_resolution)
{
	Parameters params = mCamera.getParameters();
	params.setPictureSize(new_resolution.width, new_resolution.height);
	mCamera.setParameters(params);
}
 
开发者ID:diedricm,项目名称:MapEver,代码行数:7,代码来源:CornerDetectionView.java


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