title: Android opencv camera rotation issue in mobile device
body: <p>I have developed an android application for a specific tablet device of 800 * 480 screen resolution. The project objective is to capture the image(with face detection). For this I used opencv2.4.2 sdk to capture image(used opencv face detection sample). In that device the camera available in the right bottom corner. So I captured image with the reverse portrait mode(using transpose the image).</p>
  
  <pre><code>The code snippet is below:
      @Override
      protected Bitmap processFrame(VideoCapture capture) {
          FdActivity.mSquaredImage = 0;
          resolution = 0;
          capture.retrieve(mRgba, Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA);
          capture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME);        
          Core.transpose(mRgba, mRgba);
          Core.transpose(mRgba, mGray);
          .....
          .....
          return bmp;
      }
  </code></pre>
  
  <p>It is working fine in android tablet.</p>
  
  <p>Now I want to use my application with mobile device. So I tested it with SAMSUNG GALAXY S II. </p>
  
  <p>And I got one issue.</p>
  
  <pre><code>The following code is to open the camera.
      The code snippet is below:
      public boolean openCamera() {
          Log.i(TAG, "openCamera");
          synchronized (this) {
              releaseCamera();
              mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID);
              if (!mCamera.isOpened()) {
                  mCamera.release();
                  mCamera = null;
                  Log.e(TAG, "Failed to open native camera");
                  return false;
              }
          }
          return true;
      }
  </code></pre>
  
  <p>This code opens the front camera in tablet. But in SAMSUNG GALAXY S II it opens the back camera. For this I searched in opencv.org forum and I got the following solution,</p>
  
  <pre><code>        mCamera = new VideoCapture(Highgui.CV_CAP_ANDROID+1);
  </code></pre>
  
  <p>Now It opens the front camera in SAMSUNG GALAXY S II. But in the tablet I got <strong>"can't open camera"</strong> error. what may be the problem. And I tested with HTC desire android device. But it shows only blank screen(camera not opened). </p>
  
  <p><strong>The new requirement is the user hold with the position of camera in the top of the device. If they rotate the device the screen and image shouldn't rotate</strong>.</p>
  
  <p>It is very urgent. Please can someone help me to fix this?</p>