Hallo,

I want to use the camera preview for image recognition. For my
purposes, I need the preview resolution to be as high as possible
(and, at the same time, display the preview to the user).

I created a Preview class, extending SurfaceView and set the
PreviewSize to 1280x720. I added a PreviewCallBack to get the live
Image:

(Code:)

camera = Camera.open();
parameters = camera.getParameters();
parameters.setPreviewSize(1280,720);

camera.setParameters( parameters);
byte[] b = new byte[camera.getParameters().getPreviewSize().width *
  camera.getParameters().getPreviewSize().height *
 
ImageFormat.getBitsPerPixel(camera.getParameters().getPreviewFormat()) /
8];
camera.addCallbackBuffer(b);
camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback());

try {
 camera.setPreviewDisplay(this.getHolder());
 camera.startPreview()
} (...)


My Byte Array b is 1382400 Byte and my
CameraPreviewCallback.onPreviewFrame() function receives those 1382400
Bytes - but only the first 497664 Byte contain data (matching a
768x432 resolution).

I tested this on different devices, all with display resolutions of
800x480 (HTC Desire, LG Optimus 3D, Samsung Galaxy S2, Samsung Galaxy
Tab, ...).

Does anyone know how to receive the full 720p resolution as a Byte
Array?

Regards

Joern

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to