android-Camera2Basic icon indicating copy to clipboard operation
android-Camera2Basic copied to clipboard

Preview display skewed

Open JohnGoertz opened this issue 11 years ago • 21 comments

Sometimes the preview presents a skewed image, as if you were elongating the image. Here's the most consistent way I can reproduce this:

  1. Start the app with phone in portrait mode. Preview may or may not be fine. If it is fine:
  2. Rotate the phone to landscape. Preview should stay fine.
  3. Rotate back to portrait. Now the preview should be weird and skewed.

I know that's a confusing description, hopefully you can reproduce it. I'm guessing it has to do with the configureTransform method?

JohnGoertz avatar Apr 23 '15 03:04 JohnGoertz

I have the same exactly problem using front camera. When you enter the app image is weirdly stretched. If you exit and reenter the app then camera just works fine.

iasontsitsaris avatar Jun 04 '15 14:06 iasontsitsaris

What device are you using?

yaraki avatar Jun 16 '15 08:06 yaraki

I am using a Sony Xperia Z1. I was also forced to comment code for autofocus because the app was crushing. I was trying to understand what was different in onStop() and onResume() methods but I didn't worked it out.

iasontsitsaris avatar Jun 16 '15 09:06 iasontsitsaris

I'm using a HTC One m7 running CyanogenMod 12.0.

On Tue, Jun 16, 2015, 4:55 AM Yuichi Araki [email protected] wrote:

What device are you using?

— Reply to this email directly or view it on GitHub https://github.com/googlesamples/android-Camera2Basic/issues/9#issuecomment-112345895 .

JohnGoertz avatar Jun 16 '15 14:06 JohnGoertz

I am using Moto G (XT1033). The preview is skewed as shown below with the start of the activity. On resuming the activity, the preview turns back to normal. device-2015-06-23-210636 device-2015-06-23-210535

ishit avatar Jun 23 '15 15:06 ishit

Hey guys, do you fix the problem ? I got the same problem. When the preview is skewed, I just turned the screen off and turn back on again and the preview is fine now.

CJZwork avatar Aug 14 '15 05:08 CJZwork

Same here. It also gives me an error "E/BufferQueueProducer﹕ [unnamed-26081-14] dequeueBuffer: min undequeued buffer count (2) exceeded (dequeued=6 undequeued=1)" followed by "E/BufferQueueProducer﹕ [unnamed-26081-14] dequeueBuffer: BufferQueue has been abandoned"

Any idea how to fix this?

mlu42 avatar Oct 15 '15 16:10 mlu42

Had the same problem. Fixed by hiding the bars ontop.

HaakonBj avatar Oct 29 '15 16:10 HaakonBj

Bars on top? You meant the action bar?

mlu42 avatar Nov 14 '15 16:11 mlu42

Yea the Bar that says Camera2 with the back button and the bar with the battery and all that.

HaakonBj avatar Nov 17 '15 16:11 HaakonBj

Anyone found a solution for the preview distortion problem?

vgrec avatar Oct 20 '16 14:10 vgrec

Any solution for this issue ??

DimalPerera avatar Dec 30 '16 09:12 DimalPerera

For anyone struggling with this issue check my workaround at https://stackoverflow.com/a/48138680/937678

PoloShock avatar Jan 07 '18 15:01 PoloShock

Any working solutions for this issue?

returnZro avatar Jun 27 '18 13:06 returnZro

I had the same issue with a LG Phone, solved it setting this on my TextureView Layout:

        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

GuanacoDevs avatar Jun 27 '18 15:06 GuanacoDevs

@GuanacoDevs thanks but that didn't help..

returnZro avatar Jun 27 '18 16:06 returnZro

I am also having this problem with my Galaxy Tab A 10.1" - 1920x1200 is the original solution. TextureView Ratio and size is set to 1920:1080 because I need 16:9 pictures and because the camera has no full screen functionality. The delay before opening also does not help.

Any other ideas @PoloShock ?

damaro333 avatar Sep 28 '18 09:09 damaro333

@damaro333 if the delay didn't help, I have no other thoughts, sorry. :(

PoloShock avatar Oct 01 '18 14:10 PoloShock

@PoloShock I was able to solve this issue with setting the ratio to 4:3. I did not have the problem with few 16:9 mobiles like the Galaxy J5, with the Galaxy Note 8 which is 18,5x9 ...Only with the Galaxy Tab A 10.1...the display is 16:10 and it seems to be a hardware issue.

So no hard feelings about it, will try it in a few months.

damaro333 avatar Oct 01 '18 14:10 damaro333

This sample has been migrated to a new location where we can accept Pull Requests (check README for more information).

As recommended by GitHub, we are closing all issues and pull requests now that this older repo will be archived.

If you still see this issue in the updated repo, please reopen the issue/PR there. Thank you!

codingjeremy avatar Sep 19 '19 22:09 codingjeremy