title: How to set camera resolution in Android with OpenCV?
body: <p>I'm trying to develop an app for Android, and I would need to get uncompressed pictures with a resolution as high as possible from the camera. I tried takePicture's rawCallback and postviewCallback, but they are not working.</p>
  
  <p>Right now I'm trying with OpenCV (version 2.4) using VideoCapture, but I'm stuck in the default 960x720, which is poor for what I need; and my phone, a Samsung Galaxy S3, is able to provide, theoretically, up to 8Mpx (3,264×2,448 for pictures, and 1,920×1,080 for video, according to Wikipedia). VideoCapture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH/HEIGHT, some number) makes the camera return a black image as far as I've found.</p>
  
  <p>Is there any way to obtain a higher resolution, either through OpenCV or with the Android API, without compressing?</p>
  
  <p>I'm really sorry if this has been asked before; I have been looking for days and I have found nothing.</p>
  
  <p>Thank you for your time!</p>
  
  <p>EDIT: Although it is not exactly what I was asking, I found that there is a way to do something very similar: if you set an OnPreviewCallback for the Camera, using setPreviewCallback, you do get the raw picture data from the camera (at least in the S3 I'm working with). I leave it here in case somebody finds it useful in the future.</p>
  
  <p>EDIT: A partial solution is explained in an answer below. To sum up,</p>
  
  <pre><code>vc.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, desiredFrameWidth);
  vc.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, desiredFrameHeight);
  </code></pre>
  
  <p>works under some conditions; please see below for further detail.</p>