RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.82k stars 405 forks source link

Issue with ResolutionSelectorsKt.highestResolution() calculation #320

Open hitec16 opened 5 years ago

hitec16 commented 5 years ago

What are you trying to achieve or the steps to reproduce?

I am trying to get the highest preview resolution from the camera. When I am using my own implementation of Camera API I am getting highest preview of 1920x 1080 on the pixel 2 device. However from this library, I am getting 1600x1200 resolution. Below is the Camera API code

 Camera.Parameters parameters = camera.getParameters();
        List<Camera.Size> supportedPreviewSizes =
                parameters.getSupportedPreviewSizes();

How did you initialize FA?

mFotoapparat = Fotoapparat
                .with(activity)
                .into(cameraView)
                .previewScaleType(ScaleType.CenterCrop)
                .previewResolution(ResolutionSelectorsKt.highestResolution())
                .lensPosition(LensPositionSelectorsKt.back())
                .frameProcessor(new FrameProcessor() {
                    @Override
                    public void process(Frame frame) {

                        }
                    }
                })
                .logger(loggers(
                        logcat(),
                        fileLogger(activity)
                ))
                .cameraErrorCallback(new CameraErrorListener() {
                    @Override
                    public void onError(@NotNull CameraException e) {
                        Toast.makeText(activity, e.toString(), Toast.LENGTH_LONG).show();
                    }
                })
                .build();

What was the result you received?

max preview resolution is 1600x1200

What did you expect?

it should be 1920x1080

Context:

marekfoltyn commented 5 years ago

Same here, with device Coppernic C-One. Expected resolution is 1280x720, but received 640x480. The camera view is fullscreen, the screen has resolution 1280x720.