KomalG
KomalG

Reputation: 778

Cuctom camera showing blur image in some deveices(HTC one ,Alcatol7040,LG D415 etc)

I am following below scenario to set the camera preview size.

    Camera.Parameters parameters = camera.getParameters();
    parameters.setPreviewSize(sizes.get(0).width, sizes.get(0).height);
    camera.setParameters(parameters);

It is working fine in s4,s6,note devices.But some specific devices the preview size taking lowest preview sizes.

For example if the device have 5 supported preview sizes.

06-24 15:34:20.566 I/CameraVideoTestActivity(18551): startCam 0 PrevSize: Height: 720 Width: 960

06-24 15:34:20.571 I/CameraVideoTestActivity(18551): Size Index 0 Height 720 Width 960

06-24 15:34:20.571 I/CameraVideoTestActivity(18551): Size Index 1 Height 720 Width 1280

06-24 15:34:20.571 I/CameraVideoTestActivity(18551): Size Index 2 Height 480 Width 640

06-24 15:34:20.576 I/CameraVideoTestActivity(18551): Size Index 3 Height 288 Width 352

06-24 15:34:20.576 I/CameraVideoTestActivity(18551): Size Index 4 Height 240 Width 320

In some devices the camera defaultly picking the last preview size.If i print the bitmap width and height in onpicturetaken callback it is giving width 320 height 240, then it is giving blur image.

In our case it needs to take the first supported preview size like width 960 height 720.

Upvotes: 0

Views: 55

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007369

There is no particular order for the sizes returned by getSupportedPreviewSizes(). Hence, your app should not be assuming that the sizes are in some particular order. You need to implement some selection algorithm to find the preview size that you want (e.g., largest in terms of area).

Upvotes: 0

Related Questions