This is my code in onPreviewFrame Method.
The frame that shows on the surfaceHolder is fine.
I Already set the resolution with this code at first
mCameraParameter = mCamera.getParameters();
mCameraParameter.setPreviewSize(100,150);
mCameraParameter.setPreviewFrameRate(20);
mCameraParameter.setPreviewFormat(PixelFormat.JPEG);
mCamera.setParameters(mCameraParameter);
but the picture that image get is 640 * 480
I wonder why i can't change the preview resolution.
public void onPreviewFrame(byte[] data, Camera camera) {
Log.e("PreviewCallBack", "Preview");
Camera.Parameters parameters = camera.getParameters();
Log.e("Picture Size", "width : " + parameters.getPreviewSize().width);
Log.e("Picture Size", "height : " + parameters.getPreviewSize().height);
Log.e("Array Size", "data.length : " + data.length);
YuvImage image = new YuvImage(data, parameters.getPreviewFormat(),
parameters.getPreviewSize().width,parameters.getPreviewSize().height, null);
File file = new File(Environment.getExternalStorageDirectory()
.getPath() + "/"+/*System.currentTimeMillis()*/"out.jpg");
FileOutputStream filecon = null;
try {
filecon = new FileOutputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
image.compressToJpeg(
new Rect(0, 0, image.getWidth(), image.getHeight()), 90,
filecon);
}
};