3

I have a 4:3 screen tablet (op3n dott) that has a front and back camera. If I get the preview sizes with getSupportedPreviewSizes() the flowing sizes has ben reported:

**Back camera:**
1024*576
720*480
640*480
640*360
352*288
320*240
176*144

**Front camera:**
1280*720
1024*576
640*480
176*144

When i set the 1024*576 size for the back camera and the preview layout is resizded for this size, the picture that is shown in the preview is stretched. If the preview layout is resized to 4:3 aspect ratio, so the picture is streched to 1024*768 the picture is looks ok.

With the front camera and the 1280*720 preview size, the picture in the preview is fine without any trick.

When i try the 640x480 preview size for both camera also the picture is looks fine.

So the conclusion is that the back camera with 1024*576(16:9) preview size is realy a strached 4:3 picture.

I have a friend that has a hp touchPad with similar problem.

My question is how could i know when the preview 16:9 aspect image is realy a 4:3 strached image ? Can i use the 640x480 preview size for 4:3 tablets to fix this issue ?

Syeda Zunaira
  • 5,191
  • 3
  • 38
  • 70
NePe
  • 31
  • 2
  • stretching has nothing to do with preview size and picture size. Its a mismatch between your layout size and preview size – Praveena Dec 08 '14 at 12:33
  • The layout is sized based on the preview size, so this is not a problem. – NePe Dec 08 '14 at 13:00
  • refer this question http://stackoverflow.com/questions/19577299/android-camera-preview-stretched – Praveena Dec 08 '14 at 13:05
  • Camera.Parameters params = mCamera.getParameters(); Camera.Size csize = params.getPreviewSize(); FrameLayout.LayoutParams lparams = (FrameLayout.LayoutParams)getLayoutParams(); lparams.width = csize.width; lparams.height = csize.height; – NePe Dec 08 '14 at 13:43
  • This resize of the surface may be just a bit too late. The real test would be to hardcode the surface to 1024x576 and choose this preview size as well. – Alex Cohn Apr 15 '16 at 17:10

1 Answers1

0

I find that you have to size your (pre-)view with "measureSpec" constraints while in onMeasure() so that it will appear on the screen without being stretched or squished. You may get empty spaces on one or other side if the available view real estate has a different aspect ratio.