Closed yjung0991 closed 5 years ago
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 <notifications@github.com 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 https://github.com/mitchtabian/TabianCustomCamera/issues/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.
mPreviewSize = new Size(1280, 720);
Log.d(TAG, "setUpCameraOutputs: preview width: " + mPreviewSize.getWidth());
Log.d(TAG, "setUpCameraOutputs: preview height: " + mPreviewSize.getHeight());
If that works then we know it's a problem with the mPreviewSize variable.
Wow, writing that line did solve the issue. "mPreviewSize = new Size(1920, 1080)" worked as well.
Would putting the line "mPreviewSize = new Size(1920, 1080);" at this location prevent future issues regarding resolution? Or is there some place else that should be fixed?
Print a log to see what size is selected from this part
if(largest != null){
mPreviewSize = Utility.chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
maxPreviewHeight, largest);
// print a log here
}
The size selected here is 256:144. I also checked the screenshots of my log from branch 24 end and branch 25 end and it shows 1920:1080 shrinking to 256:144.. hm..
Then the "ChooseOptimalSize" method is flawed (I doubt that), or one of the inputs to that method are incorrect. I'll take a look at that later.
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. There isn't much I can do on my end to debug this unfortunately since I don't have an S9. Replace the "largest != null" if statement with this and show me the log again please.
if(largest != null){
Log.d(TAG, "setUpCameraOutputs: largest: " + largest.toString());
mPreviewSize = Utility.chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
maxPreviewHeight, largest);
}
Hey Mitch, logcat says largest: 3264x1836 Thanks for your help!
I'm honestly really not sure. It's very strange. Just to confirm, have you tried cloning the repository fresh, going to branch 2.5, and running it? If you have, does it still give you the issue?
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):![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:![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![branch24end](https://user-images.githubusercontent.com/46734035/51223394-f77c3280-1984-11e9-82ea-1aea5ec28710.png)
Branch 2.5![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 :![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.![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!