Code Monkey home page Code Monkey logo

Comments (12)

mitchtabian avatar mitchtabian commented on August 28, 2024

from tabiancustomcamera.

mitchtabian avatar mitchtabian commented on August 28, 2024

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.

from tabiancustomcamera.

yjung0991 avatar yjung0991 commented on August 28, 2024

Wow, writing that line did solve the issue. "mPreviewSize = new Size(1920, 1080)" worked as well.
it_works01

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?
it_works02

from tabiancustomcamera.

mitchtabian avatar mitchtabian commented on August 28, 2024

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
}

from tabiancustomcamera.

yjung0991 avatar yjung0991 commented on August 28, 2024

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..

1901170041

from tabiancustomcamera.

mitchtabian avatar mitchtabian commented on August 28, 2024

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.

from tabiancustomcamera.

yjung0991 avatar yjung0991 commented on August 28, 2024

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!

from tabiancustomcamera.

mitchtabian avatar mitchtabian commented on August 28, 2024

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);
 }

from tabiancustomcamera.

yjung0991 avatar yjung0991 commented on August 28, 2024

Hey Mitch, logcat says
largest: 3264x1836
Thanks for your help!

image

from tabiancustomcamera.

mitchtabian avatar mitchtabian commented on August 28, 2024

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?

from tabiancustomcamera.

yjung0991 avatar yjung0991 commented on August 28, 2024

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!

from tabiancustomcamera.

mitchtabian avatar mitchtabian commented on August 28, 2024

I'm pretty sure I show you in this video: https://codingwithmitch.com/courses/android-custom-camera/how-use-source-code/

from tabiancustomcamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.