title: camera pixels rotated
body: <p>I want to do some image processing to the pixels gotten from the camera.</p>
  
  <p>The problem is that the pixels from the camera are rotated 90 degrees.</p>
  
  <p>Im getting the pixels inside the method <code>onPreviewFrame(byte[] data, Camera camera)</code></p>
  
  <p>I tried <code>camera.setDisplayOrientation(90);</code> and it displays the video in the correct orientation but I am still receiving the rotated pixels as stated in the documentation: </p>
  
  <blockquote>
    <p>This does not affect the order of byte array passed in
    Android.Hardware.Camera.IPreviewCallback.OnPreviewFrame(Byte[],
    Android.Hardware.Camera), JPEG pictures, or recorded videos.</p>
  </blockquote>
  
  <p>I also tried:</p>
  
  <pre><code>parameters.setRotation(90);
  camera.setParameters(parameters);
  </code></pre>
  
  <p>but that did  not work.</p>
  
  <p>I'm using android 2.2</p>
  
  <p><img src="https://i.stack.imgur.com/hqWqd.png" alt="enter image description here"></p>
  
  <p>Top image shows the SurfaceView when using <code>camera.setDisplayOrientation(90);</code></p>
  
  <p>The second image is gotten inside <code>onPreviewFrame(byte[] data, Camera camera)</code> from the <code>data</code> array. As you can see the <code>data</code> array comes rotated.</p>