Android Camera.CameraInfo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Camera.CameraInfo class.

This code example shows how to use the following methods:getCameraInfo
    /** 
     * Determine the current display orientation and rotate the camera preview 
     * accordingly. 
     */ 
    public void determineDisplayOrientation() { 
        CameraInfo cameraInfo = new CameraInfo();
        Camera.getCameraInfo(cameraId, cameraInfo);
 
        int rotation = getActivity().getWindowManager().getDefaultDisplay().getRotation();
        int degrees  = 0;
 
        switch (rotation) {
            case Surface.ROTATION_0:
                degrees = 0;
                break; 
 
            case Surface.ROTATION_90:
                degrees = 90;
                break; 
 
6
CodeRank
This code example shows how to use the following methods:getCameraInfo
This code example shows how to use the following methods:getCameraInfo
            send(R.string.chat_camera_error_version); 
        } 
    } 
     
    private int getCameraOrientation() { 
        CameraInfo info = new CameraInfo();
        Camera.getCameraInfo(cameraId, info);
        int rotation = windowManager.getDefaultDisplay().getRotation();
        int degrees = 0;
        switch (rotation) {
            case Surface.ROTATION_0: degrees = 0; break;
            case Surface.ROTATION_90: degrees = 90; break;
            case Surface.ROTATION_180: degrees = 180; break;
            case Surface.ROTATION_270: degrees = 270; break;
        } 
 
        int result;
        if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
            result = (info.orientation + degrees) % 360;
            result = (360 - result) % 360;  // compensate the mirror
5
CodeRank
This code example shows how to use the following methods:getCameraInfo
    /** 
     * Determine the current display orientation and rotate the camera preview 
     * accordingly. 
     */ 
    public void determineDisplayOrientation() { 
        CameraInfo cameraInfo = new CameraInfo();
        Camera.getCameraInfo(cameraId, cameraInfo);
 
        int rotation = getActivity().getWindowManager().getDefaultDisplay().getRotation();
        int degrees  = 0;
 
        switch (rotation) {
            case Surface.ROTATION_0:
                degrees = 0;
                break; 
 
            case Surface.ROTATION_90:
                degrees = 90;
                break; 
 
4
CodeRank
This code example shows how to use the following methods:getCameraInfo
     *  
     * @param nCameraId 
     * @return 
     */ 
    public static CameraInfo getCameraInfo(int nCameraId){
        Camera.CameraInfo info = new Camera.CameraInfo();
        Camera.getCameraInfo(nCameraId, info);
        return info;
    } 
 
    /** 
     * 背面カメラかどうかを返す 
     *  
     * @param info 
     * @return 
     */ 
    public static boolean isBackCamera(CameraInfo info){
        return info.facing == CameraInfo.CAMERA_FACING_BACK;
    } 
 
4
CodeRank
This code example shows how to use the following methods:getCameraInfo
	 * @param cameraId 相机ID,用于区分是前置摄像头还是后置摄像头,在API级别xiaoyu9d系统下此参数无用 
	 */ 
	public static int getOptimalDisplayOrientationByWindowDisplayRotation(Activity activity, int cameraId) {      
		int degrees = WindowUtils.getDisplayRotation(activity);      
		if(SystemUtils.getAPILevel() >= 9){ 
			Camera.CameraInfo info = new Camera.CameraInfo();      
			Camera.getCameraInfo(cameraId, info);      
			int result;
			if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {          
				result = (info.orientation + degrees) % 360;          
				result = (360 - result) % 360;    
			} else { 
				result = (info.orientation - degrees + 360) % 360;      
			}       
			return result;  
		}else{ 
			return 0;  
		} 
	} 
	 
4
CodeRank
This code example shows how to use the following methods:getCameraInfo
	/** 
	 * Determine the current display orientation and rotate the camera preview 
	 * accordingly. 
	 */ 
	private void determineDisplayOrientation() { 
		CameraInfo cameraInfo = new CameraInfo();
		Camera.getCameraInfo(cameraId, cameraInfo);
 
		int degrees = 0;
 
		switch (rotation) {
		case Surface.ROTATION_0:
			degrees = 0;
			break; 
 
		case Surface.ROTATION_90:
			degrees = 90;
			break; 
 
		case Surface.ROTATION_180:
4
CodeRank
This code example shows how to use the following methods:getCameraInfo
		return c; 
	} 
 
	private int getCorrectDisplayOrientation(int cameraId) 
	{ 
		CameraInfo info = new CameraInfo(); 
		Camera.getCameraInfo(cameraId, info); 
 
		int rotation = getWindowManager().getDefaultDisplay().getRotation(); 
 
		int degrees = 0; 
		switch (rotation) 
		{ 
		case Surface.ROTATION_0: 
			degrees = 0; 
			break; 
		case Surface.ROTATION_90: 
			degrees = 90; 
			break; 
		case Surface.ROTATION_180: 
4
CodeRank
This code example shows how to use the following methods:getCameraInfo
            send(R.string.chat_camera_error_version); 
        } 
    } 
     
    private int getCameraOrientation() { 
        CameraInfo info = new CameraInfo();
        Camera.getCameraInfo(cameraId, info);
        int rotation = windowManager.getDefaultDisplay().getRotation();
        int degrees = 0;
        switch (rotation) {
            case Surface.ROTATION_0: degrees = 0; break;
            case Surface.ROTATION_90: degrees = 90; break;
            case Surface.ROTATION_180: degrees = 180; break;
            case Surface.ROTATION_270: degrees = 270; break;
        } 
 
        int result;
        if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
            result = (info.orientation + degrees) % 360;
            result = (360 - result) % 360;  // compensate the mirror
4
CodeRank
This code example shows how to use the following methods:getCameraInfo
	protected void onResume() { 
		// TODO Auto-generated method stub 
		super.onResume(); 
		cam = Camera.open(defaultCameraId);
		Parameters parameters = cam.getParameters();
		android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
		android.hardware.Camera.getCameraInfo(defaultCameraId, info);
		int rotation = this.getWindowManager().getDefaultDisplay()
				.getRotation();
		int degrees = 0;
		switch (rotation) {
		case Surface.ROTATION_0:
			degrees = 0;
			break; 
		case Surface.ROTATION_90:
			degrees = 90;
			break; 
		case Surface.ROTATION_180:
			degrees = 180;
			break; 
4
CodeRank

Related Android Camera.CameraInfo Questions & Answers:

Other Android Camera.CameraInfo Examples

46:	    int numberOfCameras = Camera.getNumberOfCameras();
47:	    for (int i = 0; i < numberOfCameras; i++) {
48:	      CameraInfo info = new CameraInfo();
49:	      Camera.getCameraInfo(i, info);
50:	      if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
-
46:	    int numberOfCameras = Camera.getNumberOfCameras();
47:	    for (int i = 0; i < numberOfCameras; i++) {
48:	      CameraInfo info = new CameraInfo();
49:	      Camera.getCameraInfo(i, info);
50:	      if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {

Read More

See Code Examples for Android Camera.CameraInfo Methods: