title: how to use frontal camera in portrait view with Android Native OpenCV
body: <p>I am trying to use native OpenCV (the latest version: OpenCV-2.4.7-android-sdk) in Android. All the samples provided by OpenCV use back camera and landscape view. I need to do such following changes:</p>
  
  <ol>
  <li>frontal camera</li>
  <li>portrait</li>
  <li>record video</li>
  </ol>
  
  <p>First I add the code "mOpenCvCameraView.setCameraIndex(1);" to use frontal camera. It works but the image showed on the screen is rotated (head down). I have to use flip function in OpenCV to let it show correctly. However, the image data will also be flipped. That is if I want to do image processing. I have to do transpose and flip operation. I tried these step. It is really time-consuming. Even I do nothing else, the video is not real-time. </p>
  
  <p>Second, to avoid flip process, I try to use portrait view by modify the XML file by "android:screenOrientation="portrait"". It also works but here is the problem, only part of the image can be showed on the screen. It looks like the image is cropped. This problem is very common. I googled a lot but still cannot find a solution. I found if I use CameraView class in Android, it will use the default camera App. it is fine but I don't know how to manipulate the image data by OpenCV since I am new to Jave/Android. </p>
  
  <p>Finally, I would like to save the processed images into a video. I noticed that OpenCV does not provide this function.</p>
  
  <p>Anybody can help me to solve this problem? Thanks. </p>