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

Bad auto-focus #15

Closed
fikisipi opened this issue Apr 26, 2015 · 3 comments
Closed

Bad auto-focus #15

fikisipi opened this issue Apr 26, 2015 · 3 comments

Comments

@fikisipi
Copy link

I think this project doesn't use the parts of ZXing that do the autofocusing.

It seems to only do it at big intervals, the image is really blurry which means I have to wait 10-15 seconds in order to scan a QR code.

I'm running latest version on Galaxy S3 (Android 4.4) with zxing-core:3.2

@dlazaro66
Copy link
Owner

Hi!

I think this project doesn't use the parts of ZXing that do the autofocusing.

As you can see here, I'm using exactly the same AutoFocusManager Class from Zxing project:
https://github.com/dlazaro66/QRCodeReaderView/blob/master/QRCodeReaderView-lib/qrcodereaderview/src/main/java/com/google/zxing/client/android/camera/open/AutoFocusManager.java
But instead of original 2sec to focus, I changed it for 5 sec. It worked better for me when using this project for augmented reality purposes. You can clone this repo and set this value as you need if that doesn't fits to you.

@fikisipi
Copy link
Author

I forgot to post, half an hour after posting this issue I found out the reason is the AUTO_FOCUS_INTERVAL_MS - ZXing feels better because it does it 2.5x more than QRCodeReaderView :)

Thank you for responding anyway.

@eGorets
Copy link

eGorets commented Feb 11, 2016

public class ReflectionUtils {

    public static void performInjection() {
        injectClassField(AutoFocusManager.class, "AUTO_FOCUS_INTERVAL_MS", 2000L);
    }

    private static void injectClassField(Class clazz, String fieldStr, long newValue) {
        try {
            final Field field = clazz.getDeclaredField(fieldStr);
            if (field != null) {
                field.setAccessible(true);
                Object obj = null;
                field.set(obj, newValue);
            }
        } catch (Exception e) {
            Ln.e(e, "%s injection failed for field:%s", clazz.getSimpleName(), fieldStr);
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants