-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distorted preview after adjusting for weird screen sizes #10
Comments
It looks to me like it's selecting that 256x144 camera size. It should be
selecting a larger one.
I'll take a look.
…On Tue., Jan. 15, 2019, 7:00 p.m. yjung0991 ***@***.*** wrote:
Hey Mitch, thanks for the great tutorials.
I'm currently enrolled to your custom camera course and faced with some
issues in branch 2.5.
First, here is my phone test:
[image: phone_test]
<https://user-images.githubusercontent.com/46734035/51223311-a9672f00-1984-11e9-9e70-cefbb830973c.png>
I'm getting a distorted preview like this one after adjusting for weird
screen sizes according to your instruction and code from branch 2.5:
[image: distorted_preview_after_branch25]
<https://user-images.githubusercontent.com/46734035/51223351-c996ee00-1984-11e9-8433-a29889a802ce.jpg>
The code from branch 2.4 did not show this distortion (but did have a
bottom padding) so I compared the logcat results for branch 2.4 end and 2.5
end. Here are the results:
Branch 2.4
[image: branch24end]
<https://user-images.githubusercontent.com/46734035/51223394-f77c3280-1984-11e9-82ea-1aea5ec28710.png>
Branch 2.5
[image: branch25end]
<https://user-images.githubusercontent.com/46734035/51223401-ffd46d80-1984-11e9-81db-2e75b275eaa6.png>
It seems the previewWidth and previewHeight shrink to 256:144 (!?) after
adding some new codes from branch 2.5. The first one is the change you
mention in your video, which is the configureTransform method in
Camera2Fragment :
[image: configuretransform]
<https://user-images.githubusercontent.com/46734035/51223577-aae52700-1985-11e9-81a9-2c6f523618ba.png>
The second one was not explained in the video, but it is the
setAspectRatio in your ScalingTextureView class.
[image: setaspectratio]
<https://user-images.githubusercontent.com/46734035/51223633-e2ec6a00-1985-11e9-9cb3-e7c0a0cb2e75.png>
Do you think the previewWidth and previewHeight were affected here?
How should I make the aspect ratio correct and remove the bottom paddings
in my app?
I want to know your thoughts. Thank you!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQo2UNnve4iqDvb2OpZ59fcCxuyHi2DVks5vDpXLgaJpZM4aCN_s>
.
|
I'm pretty sure it's your mPreviewSize variable. For some reason it's being set to that tiny size. Are you sure you copied my copy correctly? To test, write this write this just below the two log outputs that print the preview width and height at the bottom of the file.
If that works then we know it's a problem with the mPreviewSize variable. |
Print a log to see what size is selected from this part
|
Then the "ChooseOptimalSize" method is flawed (I doubt that), or one of the inputs to that method are incorrect. |
Just checked to see if my Utility class is different from your code in branch 2.5, and it looks they are identical. Thanks for helping me out! |
This is very strange. I own an s8 and the screen is almost identical.
|
I'm honestly really not sure. It's very strange. |
Hi Mitch, I haven't tried to clone it because I am not familiar with github. But I will try it and check the logs again, get back to you. Thanks! |
I'm pretty sure I show you in this video: https://codingwithmitch.com/courses/android-custom-camera/how-use-source-code/ |
Hey Mitch, thanks for the great tutorials.
I'm currently enrolled to your custom camera course and faced with some issues in branch 2.5.
First, here is my phone test (Samsung Galaxy S9):
I'm getting a distorted preview like this one after adjusting for weird screen sizes according to your instruction and code from branch 2.5:
The code from branch 2.4 did not show this distortion (but did have a bottom padding) so I compared the logcat results for branch 2.4 end and 2.5 end. Here are the results:
Branch 2.4
Branch 2.5
It seems the previewWidth and previewHeight shrink to 256:144 (!?) after adding some new codes from branch 2.5. The first one is the change you mention in your video, which is the configureTransform method in Camera2Fragment :
The second one was not explained in the video, but it is the setAspectRatio in your ScalingTextureView class.
Do you think the previewWidth and previewHeight were affected here?
How should I make the aspect ratio correct and remove the bottom paddings in my app?
I want to know your thoughts. Thank you!
The text was updated successfully, but these errors were encountered: