Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera 1 dark preview #139

Closed
JPLITPeople opened this issue Nov 28, 2017 · 5 comments
Closed

Camera 1 dark preview #139

JPLITPeople opened this issue Nov 28, 2017 · 5 comments
Labels
Milestone

Comments

@JPLITPeople
Copy link

JPLITPeople commented Nov 28, 2017

Some devices are showing a very dark preview comparing to stock camera (specially on low light environments).

Aparently the problem is from the devices and not Fotoapparat. The issue seems to be the Fps range reported. The problematic devices show the same number for lowest and highest range. (ex: [15000,15000] while choosing rangeWithHighestFps or rangeWithLowestFps.

The solution for me was to add a new function:

public static SelectorFunction<Collection<Range<Integer>>, Range<Integer>> customFpsRange() {
    return new SelectorFunction<Collection<Range<Integer>>, Range<Integer>>() {
        @Override
        public Range<Integer> select(Collection<Range<Integer>> items) {
            if (items.isEmpty()) {
                return null;
            }

            ArrayList<Range<Integer>> rangeArraylist= new ArrayList<>();
             for (Range<Integer> range : items) {

                if (range.highest().intValue() != range.lowest().intValue()) {

                    rangeArraylist.add(range);
                }

            }

            if (!rangeArraylist.isEmpty()) {

                return Collections.max(rangeArraylist, COMPARATOR_BY_BOUNDS);
            } else {

                return Collections.max(items, COMPARATOR_BY_BOUNDS);
            }

        }
    };
}

This gets all the ranges that have different lowest and highest values, and chooses the max from it.

This fixed most my problems with it. Altough some devices were still a bit dark, so i had to play a bit with the sensorSensitivitySelectors. Giving the lowest value would still make some devices a bit dark, but nothing compared to before

@Diolor
Copy link
Member

Diolor commented Nov 28, 2017

This is very interesting @JPLITPeople ! Do you have some example devices which have an obvious (easily reproducible) issue?

I know that in Nexus 6P e.g. facebook messenger produces darker images than the stock camera app.

@JPLITPeople
Copy link
Author

JPLITPeople commented Nov 28, 2017

I've tested on:

  • Nvidia Shield K1
  • Wiko pulp
  • Lenovo Phab 2 pro
  • Samsung S8

But you can test it on a dark or really low light environment, switching from fotoapparat camera to stock camera and check if the image is darker. Altough not all devices will be really dark, you can spot the diferences when the "bug" occurs.

I'm using ISO around 400 as well

EDIT: Testing now with samsung S8
EDIT: S8 is the perfect example for this. On low light conditions the preview is pitch black!
Using the tweak i mentioned gets the image perfectly visible (with lowestSensorSensitivity()), and it gets really perfect (as the stock camera) using ISO value 400

@Diolor
Copy link
Member

Diolor commented Dec 8, 2017

Brain dump/todo: maybe we can improve our fps selectors by prioritizing non-fixed rates than fixed ones

@Diolor Diolor added bug and removed improvement labels Dec 9, 2017
@Diolor
Copy link
Member

Diolor commented Dec 9, 2017

Ok this is a bug in our selectors. Non-fixed rates must be selected earlier than fixed ones

@Diolor Diolor added this to the 2.0.0 milestone Dec 13, 2017
@Diolor
Copy link
Member

Diolor commented Dec 31, 2017

New selectors added in v2

@Diolor Diolor closed this as completed Dec 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants