Git Product home page Git Product logo

Comments (5)

gauravk95 avatar gauravk95 commented on August 23, 2024 1

What is the camera resolution you have set in the camera parameter?
And does your device support that camera resolution..!

Remember that not all devices support all resolution..so you will have to get the list of supported camera resolution and then set the resolution or any other parameters... accordingly.. otherwise usually app crashes...

There are multiple resources online to do so...

Hope it helps..

from ar-location-based-android.

brutallyminimal avatar brutallyminimal commented on August 23, 2024 1

In ARCamera.java (Line 206) - replace your surfaceChanged() function with the following -

public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    if(camera != null) {
        this.cameraWidth = width;
        this.cameraHeight = height;

        Camera.Size previewSize = supportedPreviewSizes.get(0);

        Camera.Parameters params = camera.getParameters();
        params.setPreviewSize(previewSize.width, previewSize.height);
        requestLayout();

        camera.setParameters(params);
        camera.startPreview();

        generateProjectionMatrix();
    }
}

from ar-location-based-android.

candidobugarin avatar candidobugarin commented on August 23, 2024

Do you know where code is possible to set the camera resolution? Would it be the z_near and z_far parameters?

from ar-location-based-android.

gauravk95 avatar gauravk95 commented on August 23, 2024

In the ARCamera.java Line 212. we have params.setPreviewSize(previewSize.width, previewSize.height);
Change the width and height to an appropriate one.
Try hardcoding it first like(choose one of the supported camera resolution by your device)
params.setPreviewSize(1280,720); //1280*720 resolution

Though getOptimalPreviewSize() in ARCamera line 167 is suppose to select an appropriated camera resolution of the device, it maybe not picking the right resolution in your case.
You can output the selected preview size and see if the selected resolution are the supported ones.

If this is also not helping, try checking for the other camera parameters like focus mode etc. See if making the orientation of the the activity to either landscape or portrait helps. Also check if camera permission is given.

Most of these are already handled by the ARCamera.java but i guess there some issue in your case.

NOTE: z_near and z_far are parameters related to creating the viewing frustum in OpenGL ES. i.e it's used to define the space in which the rendering is viewed.

from ar-location-based-android.

anuloo avatar anuloo commented on August 23, 2024

is anyone manage to make it work in landscape at all?
changing camera size did not work for me.
Any example would appreciated

from ar-location-based-android.

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.