Giter Site home page Giter Site logo

Comments (2)

nonam4 avatar nonam4 commented on June 14, 2024

@imelos this will be difficult to fix without access to the device, logs, and other relevant information.

However, I suspect the problem might be related to scale values.

Perhaps these values are higher than they should be? 🤔

from react-native-vision-camera-face-detector.

mrousavy avatar mrousavy commented on June 14, 2024

@nonam4 I also btw just experienced a similar issue on iOS, not sure if it's the same cause, but basically scaleX and scaleY shouldn't be done.

let scaleX = screenBounds.size.width / CGFloat(frame.width)
let scaleY = screenBounds.size.height / CGFloat(frame.height)

You are making assumptions about a preview view here, whereas the coordinate system of a Frame Processor should always be the same of the Frame (.width/.height).

The user is responsible for converting that to preview coordinates. Maybe I can expose a function that does that.
But in reality it's just not as simple to scale it, because sometimes there's a pixel-shift involved, sometimes the width/height are flipped on Android, etc.

And in my case that was wrong (I explicitly patched this lib and set scaleX and scaleY to 1) because I am drawing in a Skia Frame Processor - and those use the same coordinate system as the Frame. It will be auto-scaled by the Preview later. mrousavy/react-native-vision-camera#2743

So I recommend you remove the scaling from your code, and let the user manually convert that to preview coordinates if needed. In Skia Frame Processors the user doesn't need to do that, it is just always the Frame coordinates.

from react-native-vision-camera-face-detector.

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.