private void setZoom(Camera.Parameters paramParameters) {
   String str1 = paramParameters.get("zoom-supported");
   if ((str1 != null) && (!Boolean.parseBoolean(str1))) {}
   int i;
   label154:
   do {
     return;
     i = 27;
     str2 = paramParameters.get("max-zoom");
     if (str2 != null) {}
     try {
       double d = Double.parseDouble(str2);
       int n = (int) (10.0D * d);
       if (i > n) {
         i = n;
       }
     } catch (NumberFormatException localNumberFormatException3) {
       for (; ; ) {
         Log.w(TAG, "Bad max-zoom: " + str2);
       }
     }
     str3 = paramParameters.get("taking-picture-zoom-max");
     if (str3 != null) {}
     try {
       int m = Integer.parseInt(str3);
       if (i > m) {
         i = m;
       }
     } catch (NumberFormatException localNumberFormatException2) {
       for (; ; ) {
         String str4;
         String str5;
         Log.w(TAG, "Bad taking-picture-zoom-max: " + str3);
       }
     }
     str4 = paramParameters.get("mot-zoom-values");
     if (str4 != null) {
       i = findBestMotZoomValue(str4, i);
     }
     str5 = paramParameters.get("mot-zoom-step");
     if (str5 != null) {}
     try {
       int j = (int) (10.0D * Double.parseDouble(str5.trim()));
       if (j > 1) {
         int k = i % j;
         i -= k;
       }
     } catch (NumberFormatException localNumberFormatException1) {
       break label154;
     }
     if ((str2 != null) || (str4 != null)) {
       paramParameters.set("zoom", String.valueOf(i / 10.0D));
     }
   } while (str3 == null);
   paramParameters.set("taking-picture-zoom", i);
 }
 private void setFlash(Camera.Parameters paramParameters) {
   if ((Build.MODEL.contains("Behold II")) && (CameraManager.SDK_INT == 3)) {
     paramParameters.set("flash-value", 1);
   }
   for (; ; ) {
     paramParameters.set("flash-mode", "off");
     return;
     paramParameters.set("flash-value", 2);
   }
 }
 private void setFlash(Camera.Parameters parameters) {
   // FIXME: This is a hack to turn the flash off on the Samsung Galaxy.
   // And this is a hack-hack to work around a different value on the Behold II
   // Restrict Behold II check to Cupcake, per Samsung's advice
   // if (Build.MODEL.contains("Behold II") &&
   //    CameraManager.SDK_INT == Build.VERSION_CODES.CUPCAKE) {
   if (Build.MODEL.contains("Behold II") && CameraManager.SDK_INT == 3) { // 3 = Cupcake
     parameters.set("flash-value", 1);
   } else {
     parameters.set("flash-value", 2);
   }
   // This is the standard setting to turn the flash off that all devices should honor.
   parameters.set("flash-mode", "off");
 }
  private void initCameraParameters() {
    Camera.Parameters parameters = mCamera.getParameters();
    String mod = Build.MODEL;
    if (Build.VERSION.SDK_INT >= 8) {
      // MZ 180, other 90...
      if ("M9".equalsIgnoreCase(mod) || "MX".equalsIgnoreCase(mod)) {
        setDisplayOrientation(mCamera, 180);
      } else {
        setDisplayOrientation(mCamera, 90);
      }
    } else {
      parameters.set("orientation", "portrait");
      parameters.set("rotation", 90);
    }

    if (cameraCurrentlyLocked == CameraInfo.CAMERA_FACING_FRONT) {
      ismCameraCanFlash = false;
    } else {
      ismCameraCanFlash = true;
    }
    if (!ismCameraCanFlash) {
      mBtnFlash1.setVisibility(View.INVISIBLE);
      mBtnFlash2.setVisibility(View.INVISIBLE);
      mBtnFlash3.setVisibility(View.INVISIBLE);
    } else {
      mBtnFlash1.setVisibility(View.VISIBLE);
    }

    List<String> focusModes = parameters.getSupportedFocusModes();
    if (focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
      // Autofocus mode is supported
      parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
    }

    if (parameters.isZoomSupported()) {
      parameters.setZoom(parameters.getZoom()); // 测试通过
    }
    Camera.Size previewSize = getFitParametersSize(parameters.getSupportedPreviewSizes());
    parameters.setPreviewSize(previewSize.width, previewSize.height);
    Camera.Size pictureSize = getFitParametersSize(parameters.getSupportedPictureSizes());
    parameters.setPictureSize(pictureSize.width, pictureSize.height);

    try {
      mCamera.setParameters(parameters);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
示例#5
0
 /** 给摄像头设置好一系列相关参数,并开始预览 */
 private void initCamera() {
   azLog.log("isPreView", "" + isPreview);
   if (mCamera != null && !isPreview) {
     try {
       Camera.Parameters parameters = mCamera.getParameters();
       // 设置预览照片的大小
       parameters.setPreviewSize(mPreviewWidth, mPreviewHeight);
       // 设置预览照片时每秒显示多少帧的最小值和最大值
       parameters.setPreviewFpsRange(mFrameMin, mFrameMax);
       // 设置图片格式
       parameters.setPictureFormat(mImageFormat);
       // 设置JPG照片的质量
       parameters.set("jpeg-quality", mImageQuality);
       // 设置照片的大小
       parameters.setPictureSize(mPictureWidth, mPictureHeight);
       // 通过SurfaceView显示取景画面
       mCamera.setPreviewDisplay(mSurfaceHolder);
       // 开始预览
       mCamera.startPreview();
       azLog.log("AzCamera", "摄像头打开");
     } catch (IOException e) {
       e.printStackTrace();
     }
     isPreview = true;
   }
 }
示例#6
0
  /** sets the Orientation of the camera Preview o be the same as MoSyncApp */
  private void setCameraDisplayOrientation() {
    // Use reflection to correct the preview on 2.2 and higher versions
    try {
      mCameraDisplayOrientation =
          mCamera.getClass().getMethod("setDisplayOrientation", Integer.TYPE);

      // Set the orientation of the picture on old Android phones
      Camera.Parameters parameters = mCamera.getParameters();

      if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        parameters.set("orientation", "portrait");
        // default camera orientation on android is landscape
        // So we need to rotate the preview
        parameters.setRotation(90);
        mCamera.setDisplayOrientation(90);
      } else if (getResources().getConfiguration().orientation
          == Configuration.ORIENTATION_LANDSCAPE) {
        parameters.set("orientation", "landscape");
        parameters.setRotation(0);
        mCamera.setDisplayOrientation(0);
      }
      mCamera.setParameters(parameters);
    } catch (NoSuchMethodException nsme) {
      SYSLOG("ANDROID Version is less than 2.2!!");
      // Set the orientation of the picture on old Android phones
      Camera.Parameters parameters = mCamera.getParameters();

      // an Ugly hack to make HTC wildfire work
      if (Build.MANUFACTURER.equals("HTC")) {
        parameters.set("orientation", "landscape");
        parameters.setRotation(90);
      }
      // rest of the phones work fine with the standard settings
      else if (getResources().getConfiguration().orientation
          == Configuration.ORIENTATION_PORTRAIT) {
        parameters.set("orientation", "portrait");
        parameters.setRotation(90);
      } else if (getResources().getConfiguration().orientation
          == Configuration.ORIENTATION_LANDSCAPE) {
        parameters.set("orientation", "landscape");
        parameters.setRotation(0);
      }
      mCamera.setParameters(parameters);
    } catch (RuntimeException e) {
      SYSLOG("Failed to set camera Parameters");
    }
  }
  /*
  Sets the camera up to take preview images which are used for both preview and decoding
    */
  private void setCameraParameters() {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();
    Log.v(TAG, "Default preview size: " + size.width + ", " + size.height);
    previewFormat = parameters.getPreviewFormat();
    previewFormatString = parameters.get("preview-format");
    Log.v(TAG, "Default preview format: " + previewFormat);

    // Ensure that the camera resolution is a multiple of 8, as the screen may not be.
    cameraResolution = new Point();
    cameraResolution.x = (screenResolution.x >> 3) << 3;
    cameraResolution.y = (screenResolution.y >> 3) << 3;
    Log.v(TAG, "Setting preview size: " + cameraResolution.x + ", " + cameraResolution.y);
    parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
    parameters.set("flash-value", 2);
    parameters.set("flash-mode", "off");
    camera.setParameters(parameters);
  }
 /**
  * Sets the camera up to take preview images which are used for both preview and decoding. We
  * detect the preview format here so that buildLuminanceSource() can build an appropriate
  * LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest, and
  * the planar Y can be used for barcode scanning without a copy in some cases.
  */
 void setDesiredCameraParameters(Camera camera) {
   Camera.Parameters parameters = camera.getParameters();
   Log.d(TAG, "Setting preview size: " + cameraResolution);
   parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
   // setFlash(parameters);
   // setZoom(parameters);
   parameters.set("zoom", "0");
   // setSharpness(parameters);
   Log.d(TAG, "Camera parameters flat: " + parameters.flatten());
   camera.setParameters(parameters);
 }
示例#9
0
文件: MarvinEye.java 项目: ghk/Marvin
  @Override
  public void surfaceCreated(SurfaceHolder arg0) {
    camera = Camera.open();
    Camera.Parameters params = camera.getParameters();
    camera.setDisplayOrientation(90);
    params.setRotation(90);
    params.set("orientation", "landscape");
    params.set("rotation", 90);
    params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
    Camera.Size previewSize = params.getPreviewSize();
    List<Camera.Size> previewSizes = params.getSupportedPreviewSizes();
    int i = 0;
    for (Camera.Size cs : previewSizes) {
      Log.d(MarvinActivity.TAG, "Camera - supports:(" + (i++) + ") " + cs.width + "x" + cs.height);
    }

    previewSize.width = 720;
    previewSize.height = 480;

    params.setSceneMode("portrait");
    Log.d(MarvinActivity.TAG, "w: " + previewSize.width + " h: " + previewSize.height);
    List<Integer> formats = params.getSupportedPreviewFormats();
    for (Integer format : formats) {
      Log.d(MarvinActivity.TAG, "Camera - supports preview format: " + format);
    }
    params.setPreviewSize(previewSize.width, previewSize.height);
    camera.setParameters(params);

    detectThread = new FaceDetectThread(context, user, params);
    detectThread.start();
    camera.setPreviewCallback(detectThread);
    try {
      camera.setPreviewDisplay(cameraView.getHolder());
      camera.startPreview();
      Log.d(MarvinActivity.TAG, "preview started");
    } catch (Exception e) {
      Log.e(MarvinActivity.TAG, e.getMessage(), e);
    }
    user.onEyeStarted();
  }
  private void startCameraPreview(Camera camera) {
    if (camera != null && mProducer != null && mVideoFrame != null) {
      try {
        Log.d(TAG, String.format("setPreviewSize [%d x %d ]", mWidth, mHeight));
        Camera.Parameters parameters = camera.getParameters();
        parameters.setPreviewSize(mWidth, mHeight);
        camera.setParameters(parameters);
      } catch (Exception e) {
        Log.e(TAG, e.toString());
      }

      try {
        int terminalRotation = getTerminalRotation();
        Camera.Parameters parameters = camera.getParameters();
        if (terminalRotation == 0) {
          parameters.set("orientation", "landscape");
        } else {
          parameters.set("orientation", "portrait");
        }
        camera.setParameters(parameters);
      } catch (Exception e) {
        Log.e(TAG, e.toString());
      }

      // Camera Orientation
      int rotation = compensCamRotation(false);
      Log.d(TAG, String.format("setDisplayOrientation [%d] ", rotation));
      NgnCameraProducer.setDisplayOrientation(camera, rotation);

      // Callback Buffers
      if (NgnProxyVideoProducer.sAddCallbackBufferSupported) {
        for (int i = 0; i < NgnProxyVideoProducer.CALLABACK_BUFFERS_COUNT; i++) {
          NgnCameraProducer.addCallbackBuffer(camera, new byte[mVideoFrame.capacity()]);
        }
      }

      camera.startPreview();
    }
  }
示例#11
0
 @Override
 protected void setCaptureParameters(
     int width, int height, int frameRate, Camera.Parameters cameraParameters) {
   mCaptureFormat =
       new CaptureFormat(
           s_CAM_PARAMS[mTangoCameraId].mWidth,
           s_CAM_PARAMS[mTangoCameraId].mHeight,
           frameRate,
           ImageFormat.YV12);
   // Connect Tango SuperFrame mode. Available sf modes are "all",
   // "big-rgb", "small-rgb", "depth", "ir".
   cameraParameters.set("sf-mode", "all");
 }
  public int setCameraProperty(String key, String value) {
    if (mCamera == null) {
      return MAAPI_consts.MA_CAMERA_RES_FAILED;
    }
    try {
      Camera.Parameters param = getCurrentParameters();
      if (key.equals(MAAPI_consts.MA_CAMERA_IMAGE_FORMAT)) {
        if (value.equals(MAAPI_consts.MA_CAMERA_IMAGE_RAW)) {
          rawMode = true;
        } else {
          // default mode is jpeg
          rawMode = false;
        }
      } else if (key.equals(MAAPI_consts.MA_CAMERA_FOCUS_MODE)) {
        if (value.equals(MAAPI_consts.MA_CAMERA_FOCUS_AUTO)) {
          if (false == param.getSupportedFocusModes().contains(value)) {

            return MAAPI_consts.MA_CAMERA_RES_VALUE_NOTSUPPORTED;
          }

          mCamera.autoFocus(autoFocusCallback);
        } else if (value.equals(MAAPI_consts.MA_CAMERA_FOCUS_MACRO)) {

          if (false == param.getSupportedFocusModes().contains(value)) {
            return MAAPI_consts.MA_CAMERA_RES_VALUE_NOTSUPPORTED;
          }
          mCamera.autoFocus(autoFocusCallback);
        } else if (false == param.getSupportedFocusModes().contains(value)) {
          mCamera.cancelAutoFocus();
          return MAAPI_consts.MA_CAMERA_RES_VALUE_NOTSUPPORTED;
        } else mCamera.cancelAutoFocus();

        param.setFocusMode(value);
      } else if (key.equals(MAAPI_consts.MA_CAMERA_FLASH_MODE)) {
        if (true == param.getSupportedFlashModes().contains(value)) {
          param.setFlashMode(value);
        } else {
          return MAAPI_consts.MA_CAMERA_RES_VALUE_NOTSUPPORTED;
        }
      } else {
        param.set(key, value);
      }
      mCamera.setParameters(param);
    } catch (Exception e) {
      return MAAPI_consts.MA_CAMERA_RES_FAILED;
    }
    return MAAPI_consts.MA_CAMERA_RES_OK;
  }
示例#13
0
 public boolean turnOffFlashLight() {
   if (camera != null) {
     handler.removeCallbacksAndMessages(null);
     Camera.Parameters parameter = camera.getParameters();
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
       parameter.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
     } else {
       parameter.set("flash-mode", "off");
     }
     camera.setParameters(parameter);
     camera.stopPreview();
     camera.release();
     camera = null;
   }
   return true;
 }
示例#14
0
 public boolean turnOnFlashLight() {
   if (camera == null) {
     camera = Camera.open();
     camera.startPreview();
     Camera.Parameters parameter = camera.getParameters();
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
       parameter.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
     } else {
       parameter.set("flash-mode", "torch");
     }
     camera.setParameters(parameter);
     handler.removeCallbacksAndMessages(null);
     handler.postDelayed(
         new Runnable() {
           @Override
           public void run() {
             turnOffFlashLight();
           }
         },
         OFF_TIME);
   }
   return true;
 }
示例#15
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  private boolean prepareVideoRecorder() {
    mCamera = tbs.beamr.android.sid.CamHelper.getDefaultCameraInstance();
    final Camera.Parameters parameters = mCamera.getParameters();
    List<Camera.Size> sizes = parameters.getSupportedPreviewSizes();
    if (sizes == null || sizes.size() < 1) {
      sizes = parameters.getSupportedVideoSizes();
    }

    Log.e("supported sizes > ", getSizeString(sizes));
    final Camera.Size size = getCameraSize(sizes);

    switch (hasAutoFocus(parameters)) {
      case 0:
        break;
      case 1:
        parameters.set("cam_mode", 1);
        parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
        break;
      case 2:
        parameters.set("cam_mode", 1);
        parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
        break;
    }

    mCamera.setParameters(parameters);
    try {
      mCamera.setPreviewDisplay(mPreview.getHolder());
    } catch (IOException e) {
      Log.e(TAG, "Surface View is unavailable or unsuitable" + e.getMessage());
      return false;
    }
    mMediaRecorder = new MediaRecorder();

    // Step 1: Unlock and set camera to MediaRecorder
    mCamera.setDisplayOrientation(90);
    mCamera.unlock();
    mMediaRecorder.setCamera(mCamera);

    // Step 2: Set sources
    mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    mMediaRecorder.setOrientationHint(90);

    mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    final CamcorderProfile profile =
        CamcorderProfile.get(
            CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P)
                ? CamcorderProfile.QUALITY_480P
                : CamcorderProfile.QUALITY_HIGH);
    //        profile.videoFrameRate = 25;
    //            profile.videoBitRate = 7200000;
    mMediaRecorder.setProfile(profile);
    //        if (size == null) {
    //            mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    //            final CamcorderProfile profile =
    // CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
    ////            profile.videoFrameRate = 30;
    ////            profile.videoBitRate = 7200000;
    //            mMediaRecorder.setProfile(profile);
    //        } else {
    //            // Step 3: Set a CamcorderProfile (requires API Level 8 or higher)
    //            if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P)) {
    //                final CamcorderProfile profile =
    // CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
    //                Log.e("recordingSize > ", String.valueOf(profile.videoFrameWidth) + "x" +
    // String.valueOf(profile.videoFrameHeight));
    //                mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    //                mMediaRecorder.setProfile(profile);
    //            } else {
    //                mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    //                mMediaRecorder.setVideoEncodingBitRate(8200000);
    //                mMediaRecorder.setVideoSize(size.width, size.height);
    ////            mMediaRecorder.setVideoFrameRate(20);
    //                mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
    //            }
    //        }

    // Step 4: Set output file
    // Todo
    //        final String name = Environment.getExternalStorageDirectory().getAbsolutePath() +
    // "/tbs_beamR/received_file_" + (new Date(System.currentTimeMillis())).toString() + ".mp4";
    final String name =
        Environment.getExternalStorageDirectory().getAbsolutePath() + "/test/test.mp4";
    final File file = new File(name);
    if (!file.exists()) {
      try {
        file.getParentFile().mkdirs();
        //                file.createNewFile();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    mMediaRecorder.setOutputFile(name);

    // Step 5: Prepare configured MediaRecorder
    try {
      mMediaRecorder.prepare();
    } catch (IllegalStateException e) {
      Log.e(TAG, "IllegalStateException preparing MediaRecorder: " + e.getMessage());
      releaseMediaRecorder();
      return false;
    } catch (IOException e) {
      Log.e(TAG, "IOException preparing MediaRecorder: " + e.getMessage());
      releaseMediaRecorder();
      return false;
    }
    return true;
  }
示例#16
0
  @Override
  public void surfaceCreated(SurfaceHolder arg0) {
    // TODO Auto-generated method stub
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, getActivity(), mLoaderCallback);
    mCamera = Camera.open();
    Camera.Parameters parameters = mCamera.getParameters();

    List<android.hardware.Camera.Size> sizes = parameters.getSupportedPreviewSizes();
    // if portrait frameSize , width is less than height
    Size frameSize =
        calculateCameraFrameSize(sizes, mSurface.getWidth(), mSurface.getHeight(), true);

    parameters.setPreviewSize((int) frameSize.height, (int) frameSize.width);
    parameters.set("orientation", "portrait");
    parameters.setPreviewFormat(ImageFormat.NV21);

    mFrameWidth = (int) frameSize.width;
    mFrameHeight = (int) frameSize.height;

    mCamera.setDisplayOrientation(90);

    try {
      mCamera.setPreviewDisplay(mHolder);
      mCamera.setParameters(parameters);
      mCamera.setPreviewCallback(this);
    } catch (Exception e) {

    }

    mZoomBar.setMax(mCamera.getParameters().getMaxZoom());
    mZoomBar.setProgress(mCamera.getParameters().getZoom());
    mZoomBar.setOnSeekBarChangeListener(
        new OnSeekBarChangeListener() {

          @Override
          public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
            // TODO Auto-generated method stub
            // modify zoom
            Camera.Parameters params = mCamera.getParameters();
            params.setZoom(arg1);
            mCamera.setParameters(params);

            mZoomBar.setProgress(arg1);
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub

          }
        });

    mCamera.startPreview();
    mCamera.autoFocus(mAutoFocusCallback);
  }
 public void set_camera_recover() {
   parameters.setExposureCompensation(0);
   parameters.set("scene-mode-values", "auto");
   camera.setParameters(parameters);
 }
  private void setZoom(Camera.Parameters parameters) {

    String zoomSupportedString = parameters.get("zoom-supported");
    if (zoomSupportedString != null && !Boolean.parseBoolean(zoomSupportedString)) {
      return;
    }

    int tenDesiredZoom = TEN_DESIRED_ZOOM;

    String maxZoomString = parameters.get("max-zoom");
    if (maxZoomString != null) {
      try {
        int tenMaxZoom = (int) (10.0 * Double.parseDouble(maxZoomString));
        if (tenDesiredZoom > tenMaxZoom) {
          tenDesiredZoom = tenMaxZoom;
        }
      } catch (NumberFormatException nfe) {
        Log.w(TAG, "Bad max-zoom: " + maxZoomString);
      }
    }

    String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max");
    if (takingPictureZoomMaxString != null) {
      try {
        int tenMaxZoom = Integer.parseInt(takingPictureZoomMaxString);
        if (tenDesiredZoom > tenMaxZoom) {
          tenDesiredZoom = tenMaxZoom;
        }
      } catch (NumberFormatException nfe) {
        Log.w(TAG, "Bad taking-picture-zoom-max: " + takingPictureZoomMaxString);
      }
    }

    String motZoomValuesString = parameters.get("mot-zoom-values");
    if (motZoomValuesString != null) {
      tenDesiredZoom = findBestMotZoomValue(motZoomValuesString, tenDesiredZoom);
    }

    String motZoomStepString = parameters.get("mot-zoom-step");
    if (motZoomStepString != null) {
      try {
        double motZoomStep = Double.parseDouble(motZoomStepString.trim());
        int tenZoomStep = (int) (10.0 * motZoomStep);
        if (tenZoomStep > 1) {
          tenDesiredZoom -= tenDesiredZoom % tenZoomStep;
        }
      } catch (NumberFormatException nfe) {
        // continue
      }
    }

    // Set zoom. This helps encourage the user to pull back.
    // Some devices like the Behold have a zoom parameter
    if (maxZoomString != null || motZoomValuesString != null) {
      parameters.set("zoom", String.valueOf(tenDesiredZoom / 10.0));
    }

    // Most devices, like the Hero, appear to expose this zoom parameter.
    // It takes on values like "27" which appears to mean 2.7x zoom
    if (takingPictureZoomMaxString != null) {
      parameters.set("taking-picture-zoom", tenDesiredZoom);
    }
  }
 public void set_camera(String item, int param) {
   parameters.set(item, param);
   camera.setParameters(parameters);
 }