My issue captured image is looking blurry in my application where as the image that is captured with the device camera component is looking good – something auto zoom effect is going once user click on capture button. can some one help me to achieve this scenario how and where should i apply.
here is the code:
public void surfaceChanged(SurfaceHolder holder, int format, int width,int height) {
// Now that the size is known, set up the camera parameters and begin
// the preview.
Camera.Parameters parameters = camera.getParameters();
Integer version = Integer.parseInt(Build.VERSION.SDK);
if(version > Build.VERSION_CODES.ECLAIR_MR1)
{
Log.d(TAG, "------> version greater than eclari 2.1");
List<Size> sizes = parameters.getSupportedPreviewSizes();
Size optimalSize = getOptimalPreviewSize(sizes, width, height);
parameters.setPreviewSize(optimalSize.width, optimalSize.height);
}
else
{
Log.d(TAG, "------> version less than eclari 2.1");
parameters.setPreviewSize(ApplicationInitiator.screenW,ApplicationInitiator.screenH);
}
List<String> focusModes = parameters.getSupportedFocusModes();
if (focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO))
{
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
}
parameters.setJpegQuality(100);
camera.setParameters(parameters);
camera.startPreview();
}
Well, on your text you talk about capturing a image, but I don’t see anything in your code about taking a picture, Anyway, if you want to obtain a focused photo, what you have to do is register a AutoFocusCallback to take a picture when focus is obtained:
.