I want to do some image processing to the pixels gotten from the camera.
The problem is that the pixels from the camera are rotated 90 degrees.
Im getting the pixels inside the method onPreviewFrame(byte[] data, Camera camera)
I tried camera.setDisplayOrientation(90);
and it displays the video in the correct orientation but I am still receiving the rotated pixels as stated in the documentation:
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.
I also tried:
parameters.setRotation(90);
camera.setParameters(parameters);
but that did not work.
I'm using android 2.2
Top image shows the SurfaceView when using camera.setDisplayOrientation(90);
The second image is gotten inside onPreviewFrame(byte[] data, Camera camera)
from the data
array. As you can see the data
array comes rotated.