Giter Site home page Giter Site logo

Comments (3)

josharian avatar josharian commented on May 18, 2024

As @dgoldman-ebay has commented elsewhere, card.io was designed to scan, not to take sharp images.

In general, determining absolutely whether an image is in focus is a very hard problem. We do a very crude approximation to this with our focus score calculation, which is probably what you want to look at if, you want to just try fiddling with some thresholds.

Other options include attempting to monitor focus scores over time, waiting for them to stabilize (with hysteresis), in the hopes that that indicates that the camera has finished focusing.

Or perhaps best of all, dig into the camera APIs. I seem to recall that in recent iOS versions, there's a newly-added ability to set the focal depth programatically. It might have to be set per-device, but this could entirely circumvent the entire issue.

Please do experiment with a wide range of lighting conditions and cards. We found that focus scores and related metrics tend to vary greatly...which is why the emphasis was placed on being able to scan blurry cards. :)

from card.io-ios-source.

dgoldman-pdx avatar dgoldman-pdx commented on May 18, 2024

I seem to recall that in recent iOS versions, there's a newly-added ability to set the focal depth programatically.

We're already using the AVCaptureAutoFocusRangeRestrictionNear introduced in iOS 7, which helps somewhat.

iOS 8 added setFocusModeLockedWithLensPosition:completionHandler:. It does indeed look like one could call that to set an initial guess at focus. Doing so also sets the focus mode to AVCaptureFocusModeLocked, so upon completion one would then want to set the focus mode to AVCaptureFocusModeContinuousAutoFocus to resume auto-focusing thereafter.

It will take a bit of experimenting with the lensPosition value. As @josharian speculated, Apple helpfully tells us that A given lens position value does not correspond to an exact physical distance, nor does it represent a consistent focus distance from device to device.

I'm almost talking myself into coding this myself! But I really don't have the time these days.

from card.io-ios-source.

dgoldman-pdx avatar dgoldman-pdx commented on May 18, 2024

See also #21. Maybe you two can work on this together?

from card.io-ios-source.

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.