RedApparat / Fotoapparat

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

Black bars under fluorescent lights. (Banding) #245

Closed mquerique closed 6 years ago

mquerique commented 6 years ago

Hello, I've been trying to use Fotoapparat (Java) on my app, but I'm getting random black bars on some devices, when the picture is taken under artificial lighting. I've tried to use the antiBandingMode (all 4 default options) in the camera configuration, but the problem persists.

Funny thing is, this problem does not occur when I'm using the regular camera app on those devices, only when using Fotoapparat.

Example of the issue: Banding issue

CameraConfiguration code:

private CameraConfiguration cameraConfiguration = CameraConfiguration
            .builder()
            .photoResolution(standardRatio(
                    highestResolution()
            ))
            .focusMode(firstAvailable(
                    continuousFocusPicture(),
                    autoFocus(),
                    fixed()
            ))
            .antiBandingMode(firstAvailable(
                    auto(),
                    hz60(),
                    hz50(),
                    none()
            ))
            .flash(firstAvailable(
                    off()
            ))
            .previewFpsRange(highestFps())
            .sensorSensitivity(highestSensorSensitivity())
            .build();

Fotoapparat initializer:

private Fotoapparat createFotoapparat() {
        return Fotoapparat
                .with(this)
                .into(cameraView)
                .previewScaleType(ScaleType.CenterInside)
                .lensPosition(back())
                .focusMode(firstAvailable(
                        continuousFocusPicture(),
                        autoFocus(),
                        fixed()
                ))
                .logger(loggers(
                        logcat(),
                        fileLogger(this)
                ))
                .cameraErrorCallback(new CameraErrorListener() {
                    @Override
                    public void onError(@NotNull CameraException e) {
                        Toast.makeText(PictureActivity.this, getString(R.string.txt_erro_tirar_foto), Toast.LENGTH_SHORT).show();
                    }
                })
                .build();
    }
mquerique commented 6 years ago

UPDATE

After some tests, I found out that the problem was the sensorSensitivity. Using .sensorSensitivity(manualSensorSensitivity(500)) I got rid (mostly) of the lines.

I'm sorry for opening a new Issue for this, but I was already out of hope at the time haha.