Giter Site home page Giter Site logo

nonam4 / react-native-vision-camera-face-detector Goto Github PK

View Code? Open in Web Editor NEW
56.0 2.0 11.0 1.21 MB

Vision Camera Frame Processor Plugin to detect faces using MLKit Face Detector

Home Page: https://www.npmjs.com/package/react-native-vision-camera-face-detector

License: MIT License

Ruby 1.75% JavaScript 9.01% Objective-C 2.43% Swift 19.65% TypeScript 39.41% Kotlin 27.75%
face-detection face-detector vision-camera

react-native-vision-camera-face-detector's People

Contributors

dependabot[bot] avatar hiroenzo avatar luicfrr avatar mrousavy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-vision-camera-face-detector's Issues

[BUG] Error when running build for Android

Describe the bug
When running the Android build, an error generated by Gradle occurs.

Error:
FAILURE: Build failed with an exception.
Build file '\node_modules\react-native-vision-camera-face-detector\android\build.gradle' line: 5
Could not find method safeExtGet() for arguments [kotlinVersion, 1.8.10] on object of type org.gradle.api.internal.initialization.DefaultScriptHandler.

Expected behavior
From what I've been reading, the scope of the "buildscript" is limited to the block itself, so it doesn't recognize the "safeExtGet" function.
To solve the issue, it was necessary to define the "kotlinVersion" variable globally, as this way, it's still possible to use the "safeExtGet" function.

Logs and Screenshots
Modified content:
image

Smartphone (please complete the following information):

  • Device: Samsung Galaxy M34
  • OS: Android 14 (One UI 6)
  • Vision Camera version: ^3.9.2
  • Face detector version: ^1.4.1

Working example

Hey!
I followed instructions and try to use your processor. No matter how many faces are shown in my camera I always get: detection result {"faces": {}, "frame": {"height": 1920, "orientation": "portrait", "width": 1080}}.
Can you provide a working example? It would be extremely helpful.

example for face marker

hallo @nonam4 thanks for your library and this is a great library for face detection, but iam still dont understand how to implement face marker as example i create below, can you provide me to give example how to implement it

this is showing for me
image

and this is my code

 {faces !== undefined && faces !== null && (
          <View
            style={{
              position: 'absolute',
              top: faces?.faces[0].bounds.top * (SIZE.width / faces.frame.width),
              left: faces?.faces[0].bounds.left * (SIZE.width / faces.frame.width),
              right: faces?.faces[0].bounds.right * (SIZE.width / faces.frame.width),
              bottom: faces?.faces[0].bounds.bottom * (SIZE.height / faces.frame.height),
              borderWidth: 1,
              zIndex: 999,
              backgroundColor: 'red',
              width: faces?.faces[0].bounds.width * (SIZE.width / faces.frame.width),
              height: faces?.faces[0].bounds.height * (SIZE.height / faces.frame.height),
            }}
          ></View>
        )}

smilingProbability not included

These are the only values returned when I detect a face. I've included classificationMode: "all", landmarkMode: "all", etc.

faces [{"bounds": {"height": 953, "width": 953, "x": 219, "y": 559}, "pitchAngle": -2.633754253387451, "rollAngle": -71.53734588623047, "yawAngle": -22.85000228881836}] frame 1080 x 1920 yuv Frame

Face always return empty object after upgrade vision camera to 4.0.0-beta.5

hey @nonam4 i have some issue after upgrade vision camera, before i am using 3.9.1 but there is some bug like stretch previewing camera and other bug, but after upgrade to 4.0.0-beta.5 bug is solved but no face detected or return empty object on detect faces

image

but when i rotate the camera, the face is detected
WhatsApp Image 2024-03-22 at 11 55 49_3b81d7f5

when i change to normal position or potrait the face not detected
WhatsApp Image 2024-03-22 at 11 55 49_6e9d3007

i test on android 11 there is no problem, can you help for it ?

i am using react native vision camera react-native-vision-camera": "^4.0.0-beta.9
testing on android 10 xiaomy pocophone

[BUG] Inconsistent face detection

** Bug Description**
When using the face detection feature of the Vision Camera library in my custom project on an Expo bare workflow, the detection is inconsistent. Sometimes it detects faces accurately, but often it fails to detect any faces at all, as evident from the terminal logs showing intermittent detection results.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a project using Expo bare workflow.
  2. Integrate Vision Camera and react-native-vision-camera-face-detector following the example provided.
  3. Run the app on a Pixel 7 Pro device.
  4. Observe the face detection functionality; it intermittently fails to detect faces.

Expected behavior
The face detection should consistently detect faces without intermittent failures.

Logs and Screenshots
Logs showing intermittent face detection:

LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 307.77708333333334, "width": 155.5, "x": 137.5, "y": 372.04375}, "leftEyeOpenProbability": 0.679590106010437, "pitchAngle": -6.849165439605713, "rightEyeOpenProbability": 0.8706389665603638, "rollAngle": 53.27714157104492, "smilingProbability": 0.004994028247892857, "yawAngle": 5.326096057891846}}
LOG faces {"0": {"bounds": {"height": 366.5208333333333, "width": 185.5, "x": 103, "y": 291.2083333333333}, "leftEyeOpenProbability": 0.9942908883094788, "pitchAngle": 11.596040725708008, "rightEyeOpenProbability": 0.9922314882278442, "rollAngle": -96.88375091552734, "smilingProbability": 0.014574314467608929, "yawAngle": -3.906331777572632}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 359.99375, "width": 179.25, "x": 99.75, "y": 264.0958333333333}, "leftEyeOpenProbability": 0.9979193210601807, "pitchAngle": 8.968412399291992, "rightEyeOpenProbability": 0.9988862872123718, "rollAngle": -93.2209701538086, "smilingProbability": 0.009467480704188347, "yawAngle": -5.748469829559326}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 372.54583333333335, "width": 185.5, "x": 85.75, "y": 248.53125}, "leftEyeOpenProbability": 0.9928528666496277, "pitchAngle": 8.301859855651855, "rightEyeOpenProbability": 0.997727632522583, "rollAngle": -88.34501647949219, "smilingProbability": 0.008996601216495037, "yawAngle": -8.334175109863281}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 327.35833333333335, "width": 168.5, "x": 41.25, "y": 356.4791666666667}, "leftEyeOpenProbability": 0.8463578224182129, "pitchAngle": -12.933387756347656, "rightEyeOpenProbability": 0.8650642037391663, "rollAngle": 60.45033264160156, "smilingProbability": 0.02757435292005539, "yawAngle": 4.451534748077393}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 297.23333333333335, "width": 148, "x": 17.5, "y": 407.1895833333333}, "leftEyeOpenProbability": 0.9022865295410156, "pitchAngle": 23.50724220275879, "rightEyeOpenProbability": 0.29507261514663696, "rollAngle": 88.87084197998047, "smilingProbability": 0.13751231133937836, "yawAngle": 28.76015281677246}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 317.31666666666666, "width": 155.5, "x": 17.25, "y": 349.95208333333335}, "leftEyeOpenProbability": 0.9022865295410156, "pitchAngle": 14.430815696716309, "rightEyeOpenProbability": 0.042649805545806885, "rollAngle": 98.21409606933594, "smilingProbability": 0.13751231133937836, "yawAngle": 28.81414794921875}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 343.9270833333333, "width": 168.5, "x": 9.25, "y": 243.51041666666666}, "leftEyeOpenProbability": 0.27911096811294556, "pitchAngle": 4.311995029449463, "rightEyeOpenProbability": 0.6025388240814209, "rollAngle": 64.7170181274414, "smilingProbability": 0.010426056571304798, "yawAngle": 54.951534271240234}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 698.3979166666667, "width": 337, "x": 140.75, "y": 412.2104166666667}, "leftEyeOpenProbability": 0.03194314241409302, "pitchAngle": -12.541540145874023, "rightEyeOpenProbability": 0.15379184484481812, "rollAngle": 21.207067489624023, "smilingProbability": 0.31375253200531006, "yawAngle": -0.34272608160972595}}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 698.3979166666667, "width": 342.25, "x": 141, "y": 412.2104166666667}, "leftEyeOpenProbability": 0.012776970863342285, "pitchAngle": -13.734760284423828, "rightEyeOpenProbability": 0.6025388240814209, "rollAngle": 22.649320602416992, "smilingProbability": 0.3273563086986542, "yawAngle": 5.618047714233398}}
LOG faces {"0": {"bounds": {"height": 666.2645833333333, "width": 336.75, "x": 146.5, "y": 434.3020833333333}, "leftEyeOpenProbability": 0.05539274215698242, "pitchAngle": -12.883161544799805, "rightEyeOpenProbability": 0.632347822189331, "rollAngle": 21.856197357177734, "smilingProbability": 0.3961668908596039, "yawAngle": 8.105184555053711}}
LOG faces {"0": {"bounds": {"height": 676.8083333333333, "width": 336.75, "x": 143.75, "y": 428.77916666666664}, "leftEyeOpenProbability": 0.05671572685241699, "pitchAngle": 0.5525782108306885, "rightEyeOpenProbability": 0.8734263181686401, "rollAngle": 19.077682495117188, "smilingProbability": 0.1818937361240387, "yawAngle": 24.352909088134766}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 325.35, "width": 164.75, "x": 163, "y": 212.88333333333333}, "leftEyeOpenProbability": 0.1954095959663391, "pitchAngle": 10.456294059753418, "rightEyeOpenProbability": 0.6963686943054199, "rollAngle": -94.03935241699219, "smilingProbability": 0.0058485232293605804, "yawAngle": -43.203369140625}}
LOG faces {"0": {"bounds": {"height": 319.82708333333335, "width": 156.5, "x": 136, "y": 354.97291666666666}, "leftEyeOpenProbability": 0.7634485363960266, "pitchAngle": 4.588699817657471, "rightEyeOpenProbability": 0.9383997917175293, "rollAngle": -33.952857971191406, "smilingProbability": 0.011907465755939484, "yawAngle": 39.479976654052734}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 360.49583333333334, "width": 182.25, "x": 181.75, "y": 400.16041666666666}, "leftEyeOpenProbability": 0.9868497848510742, "pitchAngle": 8.496673583984375, "rightEyeOpenProbability": 0.9841023683547974, "rollAngle": -87.61302185058594, "smilingProbability": 0.01140771247446537, "yawAngle": -8.662049293518066}}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 314.3041666666667, "width": 159.25, "x": 227.5, "y": 457.3979166666667}, "leftEyeOpenProbability": 0.7734758257865906, "pitchAngle": 12.133540153503418, "rightEyeOpenProbability": 0.7252373695373535, "rollAngle": -81.5416488647461, "smilingProbability": 0.014574314467608929, "yawAngle": -10.743473052978516}}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 274.1375, "width": 136.5, "x": 223.5, "y": 427.775}, "leftEyeOpenProbability": 0.044218361377716064, "pitchAngle": 16.660924911499023, "rightEyeOpenProbability": 0.9922314882278442, "rollAngle": -56.60077667236328, "smilingProbability": 0.022218160331249237, "yawAngle": 2.201295852661133}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 262.0875, "width": 130.5, "x": 224.75, "y": 421.75}, "leftEyeOpenProbability": 0.7856113910675049, "pitchAngle": 15.452271461486816, "rightEyeOpenProbability": 0.9929311275482178, "rollAngle": -90.56649780273438, "smilingProbability": 0.017574554309248924, "yawAngle": -15.207443237304688}}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {}
LOG faces {"0": {"bounds": {"height": 267.10833333333335, "width": 137.5, "x": 200.75, "y": 417.73333333333335}, "leftEyeOpenProbability": 0.9445556402206421, "pitchAngle": 11.816859245300293, "rightEyeOpenProbability": 0.9922314882278442, "rollAngle": -90.85006713867188, "smilingProbability": 0.01241330523043871, "yawAngle": -19.47207260131836}}

(Note: These are just excerpts; the logs frequently show LOG faces {}, indicating no faces detected.)

Smartphone (please complete the following information):

  • Device: Pixel 7 Pro
  • OS: Android 12
  • Vision Camera version: 3.9.1
  • Face detector version: 1.4.0

Additional context
The issue occurs in a custom project using the Expo bare workflow. The inconsistency in face detection makes it challenging to rely on this feature for any face-based operations within the app.
Face detector was working seamlessly in face detector version 1.3.5.

How to render face landmarks

Firstly, I would like to express my appreciation for the excellent library; it has been instrumental in my project. I have successfully used the example code provided to render bounding boxes for detected faces within my application. However, I am encountering difficulties when trying to render facial landmarks on the screen.

I am using the calcFacePosition function to calculate the positions of the bounding boxes based on the face detection output. This part works as expected. However, when attempting to apply similar logic to render facial landmarks, I am unsure how to correctly adjust the coordinates to fit the orientation and scale of the display.

Here is the function I use to calculate the face position:

function calcFacePosition(bounds: Bounds, frame: FrameData): FacePosType {
    const orientation = (() => {
      switch (frame.orientation) {
        case 'portrait':
          return 0;
        case 'landscape-left':
          return 90;
        case 'portrait-upside-down':
          return 180;
        case 'landscape-right':
          return 270;
      }
    })();
    const degrees = (orientation - 90 + 360) % 360;
    let scaleX = 0;
    let scaleY = 0;

    if (!isIos && (degrees === 90 || degrees === 270)) {
      scaleX = windowWidth / frame.height;
      scaleY = windowHeight / frame.width;
    } else {
      scaleX = windowWidth / frame.width;
      scaleY = windowHeight / frame.height;
    }

    const faceW = bounds.width * scaleX;
    const faceH = bounds.height * scaleY;
    const faceX = (() => {
      const xPos = bounds.left * scaleX;
      if (isIos) {
        return xPos;
      }
      return windowWidth - (xPos + faceW); // invert X position on android
    })();

    return {
      faceW,
      faceH,
      faceX,
      faceY: bounds.top * scaleY,
    };
}

I would appreciate guidance on how to modify this function or apply a different method to accurately position facial landmarks on the screen, taking into account different device orientations and scales.

Thank you for your time and assistance.

Pass detection options inside `initFrameProcessorPlugin`

Also btw; I really love your library it is crazy fast and works like a charm - but you should make use of the initializer.

Instead of passing the options along on each call (callback), you can pass them to initFrameProcessorPlugin as a second argument, whichh passes thhem to the native plugin constructor.

This is much more efficient.

Originally posted by @mrousavy in #31 (comment)

[QUESTION] x/y props not found on face bounds

Hello,

I've been working with the face detection feature and noticed a possible change in the return properties. Previously, I could destructure x and y from bounds like so: const { x, y } = face[0].bounds. However, in my recent implementations, I only find centerX and centerY available.

Are centerX and centerY intended as replacements for x and y? If so, could you please confirm this change and provide any guidance on adjusting to these new properties? It's crucial for the accuracy and effectiveness of my application's face detection functionality.

Thank you for your assistance and for the ongoing development and support of this feature.

Best regards

[QUESTION] crop image by bounding box

i need a picture which has only face in bounding box
i try this method
after get photo by const realPhoto = await camera.current.takePhoto();
i write a function to change bounding box to position in pixel of image

const chuyenDoiSangPixel = (
    realImgWidth: number,
    realImgHeight: number,
    frameCapture: any,
    bounds: any,
    // Thรชm biแบฟn ฤ‘รกnh dแบฅu cho hแป‡ ฤ‘iแปu hร nh iOS hoแบทc Android
  ) => {
    console.log(realImgHeight, realImgWidth);
    console.log(frameCapture.width, frameCapture.height);
    const orientation = (() => {
      switch (frameCapture.orientation) {
        case 'portrait':
          return 0;
        case 'landscape-left':
          return 90;
        case 'portrait-upside-down':
          return 180;
        case 'landscape-right':
          return 270;
      }
    })();
    const degrees = (orientation - 90 + 360) % 360;

   const widthRatio: number = realImgWidth / frameCapture.width;
    const heightRatio: number = realImgHeight / frameCapture.height;

    let captureX: number,
      captureY: number,
      capturWidth: number,
      capturHeight: number;

    if (!isIos && (degrees === 90 || degrees === 270)) {
      // Kรญch thฦฐแป›c frame bแป‹ ฤ‘แบฃo ngฦฐแปฃc do lแป—i hฦฐแป›ng camera trรชn Android
      capturWidth = bounds.height * widthRatio;
      capturHeight = bounds.width * heightRatio;
      captureX = realImgWidth - (bounds.y * widthRatio + capturWidth);
      captureY = bounds.x * heightRatio;
    } else {
      capturWidth = bounds.width * widthRatio;
      capturHeight = bounds.height * heightRatio;
      captureX = bounds.x * widthRatio;
      captureY = bounds.y * heightRatio;
    }

    return {x: captureX, y: captureY, width: capturWidth, height: capturHeight};
  }

then i call this method and save by

const {width, height} = await ImageSize.getSize(
            'file://' + realPhoto.path,
          );
          let sizeBounds = {
            x: bounds.left,
            y: bounds.top,
            height: bounds.height,
            width: bounds.width,
          };
          const cropRegion = chuyenDoiSangPixel(
            width,
            height,
            frame,
            sizeBounds,
          );
const photo = await RNPhotoManipulator.crop(
            realPhoto ? 'file://' + realPhoto.path : '',
            cropRegion,
          );

but output isnot exactly
ffd169339e33316d6822
thank alot for your help !

Face Boundaries shouldn't use Scale

Hey @nonam4, I'm creating this issue to follow up on the discussion about returned coordiantes/bounds being incorrect.

A Camera streams in it's native resolution, and sometimes in landscape orientation, since that's just how sensors work.
If I run any ML model on such a native raw frame, I expect the coordinates to be relative to exactly the frame dimensions and orientation, not the preview/screen size or orientation.

This is especially relevant when I want to draw back to the Frame (with Skia Frame Processors), because then the coordinate system will be the frame's .width and .height.

I am talking about these two lines: https://github.com/nonam4/react-native-vision-camera-face-detector/blob/22c87fe4af1fd44fdff7bf729dd9bebe41da176e/ios/VisionCameraFaceDetector.swift#L245-L246

Currently when drawing a blur mask over the face using Skia Frame Processors, it looks like this:

before.mp4

After I change scaleX and scaleY to 1.0, it will look correct:

RPReplay_Final1713799605.mp4

Can you remove scaleX/scaleY from your code, and maybe provide such converters on the JS side using the Dimensions.get('window') APIs from React Native? I think that makes more sense, especially now that people use Skia Frame Processors.

[BUG] Pixel 7a detected face boundaries not correct

i test on Xiaomi MI A2 Lite and have correct face boundaries.
My friend test on Pixel 7A and receive not correct boundaries shifted left and bottom.

I don't have access to Pixel 7a to try reproduce and fix this.
Any ideas is this possible to fix?

default example/src/index.tsx with useCameraDevice('back')
[react-native-vision-camera-face-detector] 1.4.0
[react-native-vision-camera] 4.0.0-beta.13

MI A2 Lite
right
Pixel 7a
bad

[FEAT] Is this available ?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. It would be nice if we have the option to [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context, logs or screenshots about the feature request here.

[Version 1.6.1 is notworking, need to new API]

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Logs and Screenshots
If applicable, add logs and/or screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Vision Camera version [e.g. 1.0.0]
  • Face detector version [e.g. 1.0.0]

Additional context
Add any other context about the problem here.

image
"react-native-worklets-core": "^0.4.0",
"react-native-vision-camera-face-detector": "^1.6.1",
"react-native-vision-camera": "^4.0.0-beta.11",
"react-native-reanimated": "3.8.1",
I am configuring and getting the error as shown in the picture

[QUESTION] Store face attributes/embeddings?

Hi @nonam4 , first, thanks for this great library.
I have a question if this library is capable of storing the face attributes/embeddings into the database and compare it later on for a verification? e.g. I register my face first and then use it for unlocking the app if the scanned face is valid.

I have created a prototype where it detects the face if it is inside the face placeholder but stuck here at the moment.

Thank you

[BUG ๐Ÿ›] java.lang.IllegalStateException: maxImages (6) has already been acquired, call #close before acquiring more.

When the camera is showing and using the example code on android on log show:
Captura de pantalla 2024-05-03 a la(s) 14 32 07

and on Logcat from Android studio show:
Captura de pantalla 2024-05-03 a la(s) 14 33 11

Just run the example code.

Device:
Tablet Urovo P8100
Android: 10

Package.json
`
{
"name": "ExcelMarcacion",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"postinstall": "patch-package"
},
"dependencies": {
"@eva-design/eva": "^2.2.0",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"@reduxjs/toolkit": "^2.2.3",
"axios": "^1.6.8",
"lucide-react-native": "^0.376.0",
"moment": "^2.30.1",
"native-base": "^3.4.28",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"ramda": "^0.29.1",
"react": "18.2.0",
"react-native": "0.73.8",
"react-native-blob-util": "^0.19.9",
"react-native-config": "^1.5.1",
"react-native-gesture-handler": "^2.16.1",
"react-native-reanimated": "^3.9.0",
"react-native-safe-area-context": "^4.10.1",
"react-native-screens": "^3.31.1",
"react-native-svg": "^15.2.0",
"react-native-vision-camera": "^4.0.1",
"react-native-vision-camera-face-detector": "^1.6.2",
"react-native-worklets-core": "^1.3.0",
"react-redux": "^9.1.1",
"redux": "^5.0.1",
"redux-persist": "^6.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.81",
"@react-native/eslint-config": "0.74.81",
"@react-native/metro-config": "0.74.81",
"@react-native/typescript-config": "0.74.81",
"@types/ramda": "^0.29.12",
"@types/react": "^18.2.6",
"@types/react-redux": "^7.1.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"babel-plugin-module-resolver": "^5.0.2",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}

`

Received unknown JNI type "class android.graphics.PointF"! Cannot convert to jsi::Value.

When using the front camera to recognize a face, an error occurs: Frame Processor Error: Exception in HostFunction: Received unknown JNI type "class android.graphics.PointF"! Cannot convert to jsi::Value., js engine: VisionCamera

Normal recognition using back camera.

Huawei HarmonyOS 3.0

"react-native": "0.72.4",
"react-native-reanimated": "3.7.0",
"react-native-vision-camera": "3.9.0",
"react-native-vision-camera-face-detector": "1.2.3",
"react-native-worklets-core": "0.3.0"

Question: How to represent a face position on a 2D canvas?

I need to get a Face x and y position to check if the face is centered on a 2D shape (like a square), is there any way of doing so?

I already tried bounds and landmarks, but the position does not follow the center of my face when I get a little far or a little closer to the camera... Is there any way to use detection in just a point of the camera?

[BUG] function '' cannot be shared error

Frame Processor Error: Regular javascript function '' cannot be shared. Try decorating the function with the 'worklet' keyword to allow the javascript function to be used as a worklet., js engine: VisionCamera

[QUESTION] Face mask

What is your doubt?
A clear and concise description of what you want to achieve? Ex. How can I do [...]?
Hello, I'd like to be able to add a mask to a person's face. However, if the face moves up and down, left and right, how can we ensure that the mask adjusts accordingly? Some kind of morphing is needed.
Additional context
Add any other context, log or screenshots about your question here.

IOS: The facial recognition do not work as expected in release mode

Hello,
the facial recognition work fine on debug mode, but do not work as expected on release mode

ENV :

     platform :ios, 13.4
    "react-native-reanimated": "^3.4.2",
    "react-native-vision-camera": "^3.9.0",
    "react-native-vision-camera-face-detector": "^1.2.3",
    "react-native": "0.72.3",

is there any special change should i put when i try to build the release version ?

thanks

(iOS): Doesn't build with expo modules

Great plugin!

I first got could not find module 'ExpoModulesCore' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator when trying to build for iOS, error went away when I added x86_64 to Excluded Architecture.

Now getting :

ld: building for 'iOS-simulator', but linking in object file (/path/to/project/ios/Pods/MLImage/Frameworks/MLImage.framework/MLImage[arm64][2](GMLImage.o)) built for 'iOS'

when I run on iOS. Builds fine for Android.

Here are my dependencies:

{
    "expo": "^50.0.7",
    "react-native-vision-camera": "^3.9.0",
    "react-native-vision-camera-face-detector": "^1.2.2",
    "react-native-worklets-core": "^0.3.0",
}

Got the same result using "expo": "50.0.4" as suggested in the readme

How do I use image path instead of frame object?

I know this package works with vision-camera. But can't I perform facial recognition with just the image? Because there should be a section where I can only use images.
I load the image file with react-native-image-picker (launchImageLibrary).

If I can convert the image data into a frame object, will it be useful? help please.

"react-native-image-picker": "^7.1.0",
"react-native-vision-camera": "^3.9.2",
"react-native-vision-camera-face-detector": "^1.6.3",
"react-native-worklets-core": "^1.0.0",

[BUG] Release builds failing on Android with VisionCamera v4

Describe the bug
Release builds for Android are failing using VisionCamera v4 and this plugin.

To Reproduce
Steps to reproduce the behavior:

  1. Install react-native-vision-camera@^4
  2. Install react-native-vision-camera-face-detector@latest
  3. Import both into the app
  4. Start a release build for Android (in my case, using Expo EAS local โ€“ shouldn't matter, though)

Expected behavior
Builds should succeed.

Logs and Screenshots

[...]
[RUN_GRADLEW] > Task :react-native-vision-camera:compileReleaseJavaWithJavac
[RUN_GRADLEW] > Task :react-native-vision-camera:bundleLibCompileToJarRelease
[RUN_GRADLEW] > Task :expo-modules-core:compileReleaseJavaWithJavac
[RUN_GRADLEW] Note: Some input files use or override a deprecated API.
[RUN_GRADLEW] Note: Recompile with -Xlint:deprecation for details.
[RUN_GRADLEW] Note: Some input files use unchecked or unsafe operations.
[RUN_GRADLEW] Note: Recompile with -Xlint:unchecked for details.
[RUN_GRADLEW] > Task :expo-modules-core:bundleLibCompileToJarRelease
[RUN_GRADLEW] > Task :react-native-gesture-handler:compileReleaseJavaWithJavac
[RUN_GRADLEW] > Task :repo_vision-camera-face-detector:compileReleaseKotlin FAILED
[RUN_GRADLEW] > Task :expo-application:compileReleaseKotlin
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:15:28 Unresolved reference: frameprocessor
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:16:28 Unresolved reference: frameprocessor
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:17:28 Unresolved reference: frameprocessor
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:21:10 Unresolved reference: VisionCameraProxy
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:23:5 Unresolved reference: FrameProcessorPlugin
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:234:3 'callback' overrides nothing
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:235:12 Unresolved reference: Frame
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPluginPackage.kt:7:28 Unresolved reference: frameprocessor
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPluginPackage.kt:12:7 Unresolved reference: FrameProcessorPluginRegistry
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPluginPackage.kt:13:9 Cannot infer a type for this parameter. Please specify it explicitly.
[RUN_GRADLEW] e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/0d23399a-98e6-4e6a-bf3b-88eda06710fe/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPluginPackage.kt:13:16 Cannot infer a type for this parameter. Please specify it explicitly.
[...]
[RUN_GRADLEW] FAILURE: Build failed with an exception.
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] Execution failed for task ':repo_vision-camera-face-detector:compileReleaseKotlin'.
[RUN_GRADLEW] >
[RUN_GRADLEW] A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
[RUN_GRADLEW]    > Compilation error. See log for more details
[RUN_GRADLEW] * Try:
[RUN_GRADLEW] > Run with --stacktrace option to get the stack trace.
[RUN_GRADLEW] > Run with --info or --debug option to get more log output.
[RUN_GRADLEW] > Run with --scan to get full insights.
[RUN_GRADLEW] > Get more help at https://help.gradle.org.
[RUN_GRADLEW] BUILD FAILED in 2m 29s

Smartphone (please complete the following information):

  • Device: not relevant
  • OS: Android
  • Vision Camera version: ^4
  • Face detector version: latest

Additional context
Related to this issue in the VisionCamera repo (which has to do with the vision-camera-resize-plugin): mrousavy/react-native-vision-camera#2786

The compiler errors above can be fixed by replacing the import com.mrousavy.camera.frameprocessor.* imports with import com.mrousavy.camera.frameprocessors.*. However, this leads to a new error:

e: file:///private/var/folders/h5/w2kdxkb56x9b1fvcqxrg4kt40000gn/T/eas-build-local-nodejs/69d76b88-a629-4cf1-bcc8-89c48213aaf8/build/apps/mobile/node_modules/react-native-vision-camera-face-detector/android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt:252:36 Unresolved reference: toDegrees

It seems like frame.orientation has no function property toDegrees() anymore (used in android/src/main/java/com/visioncamerafacedetector/VisionCameraFaceDetectorPlugin.kt). Taking a look at the new implementation, there's indeed no toDegrees() function anymore: https://github.com/mrousavy/react-native-vision-camera/blob/0e5a888c00fa4226d8acf7df6d56689d76e8ea71/package/android/src/main/java/com/mrousavy/camera/core/types/Orientation.kt

usereff getting typescript error

how to use reff in this library, typescript showing me an error, i want to use reff for taking picture

image

this for takingPicture function from reff
image

image

[BUG] Plugin with id 'kotlin-android' not found.

Hi, I have failed Android build.
It says:

A problem occurred configuring project ':react-native-vision-camera-face-detector'.
> compileSdkVersion is not specified. Please add it to build.gradle
"react-native": "0.71.13",
"react-native-vision-camera": "^4.0.0-beta.12",
"react-native-vision-camera-face-detector": "^1.4.0",
"react-native-worklets-core": "^0.4.0",
 "react-native-reanimated": "3.6.2",

Error logs:

BUILD FAILED in 18s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installUftDebug -PreactNativeDevServerPort=8081

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where:
    Build file '/Users/yo/www/driver-app/node_modules/react-native-vision-camera-face-detector/android/build.gradle' line: 2

  • What went wrong:
    A problem occurred evaluating project ':react-native-vision-camera-face-detector'.

Plugin with id 'kotlin-android' not found.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-vision-camera-face-detector'.

compileSdkVersion is not specified. Please add it to build.gradle

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

BUILD FAILED in 18s

at makeError (/Users/yo/www/driver-app/node_modules/execa/index.js:174:9)
at /Users/yo/www/driver-app/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/yo/www/driver-app/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
at async Command.handleAction (/Users/yo/www/driver-app/node_modules/@react-native-community/cli/build/index.js:108:9)

info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.

{
"name": "driverApp",
"version": "4.19.3",
"private": true,
"scripts": {},
"dependencies": {
"@mapbox/polyline": "^1.1.1",
"@onfido/react-native-sdk": "10.7.0",
"@react-native-async-storage/async-storage": "^1.19.3",
"@react-native-community/geolocation": "^2.0.2",
"@react-native-community/hooks": "^2.8.0",
"@react-native-community/image-editor": "^2.3.0",
"@react-native-community/netinfo": "^6.0.4",
"@react-native-community/picker": "^1.8.1",
"@react-native-community/toolbar-android": "^0.2.1",
"@react-native-firebase/analytics": "^14.7.0",
"@react-native-firebase/app": "^14.7.0",
"@react-native-firebase/crashlytics": "^14.7.0",
"@react-native-firebase/messaging": "^14.7.0",
"@react-native-firebase/perf": "^14.7.0",
"@react-native-masked-view/masked-view": "^0.2.9",
"@react-navigation/bottom-tabs": "^6.5.4",
"@react-navigation/compat": "^5.3.20",
"@react-navigation/material-top-tabs": "^6.5.3",
"@react-navigation/native": "^6.1.3",
"@react-navigation/native-stack": "^6.9.9",
"@react-navigation/stack": "^6.3.12",
"@stripe/stripe-react-native": "0.35.1",
"@types/mapbox__polyline": "^1.0.1",
"@types/point-in-polygon": "^1.0.0",
"axios": "^0.27.2",
"clevertap-react-native": "^1.1.0",
"code-push": "4.0.5",
"dayjs": "^1.11.1",
"deprecated-react-native-prop-types": "^4.1.0",
"geolib": "^3.3.1",
"humanize-duration": "^3.24.0",
"i18next": "^19.8.1",
"i18next-async-storage-backend2": "^2.0.3",
"i18next-chained-backend": "^2.0.1",
"i18next-http-backend": "^1.3.1",
"jsc-android": "^241213.1.0",
"libphonenumber-js": "^1.10.14",
"lodash": "^4.17.20",
"mobx": "^5.15.6",
"mobx-persist": "^0.4.1",
"mobx-react": "^6.3.0",
"moment": "^2.29.1",
"moment-range": "^4.0.2",
"moment-timezone": "^0.5.31",
"patch-package": "^8.0.0",
"point-in-polygon": "^1.0.1",
"prop-types": "^15.7.2",
"query-string": "^6.13.7",
"react": "18.2.0",
"react-dom": "^17.0.2",
"react-i18next": "^11.7.3",
"react-lifecycles-compat": "^3.0.4",
"react-native": "0.71.13",
"react-native-alertbox": "^0.2.11",
"react-native-base64": "0.1.0",
"react-native-bluetooth-state-manager": "^1.3.2",
"react-native-bootsplash": "^4.0.2",
"react-native-calendar-events": "^2.2.0",
"react-native-camera": "^4.2.1",
"react-native-check-box": "^2.1.7",
"react-native-circular-progress": "^1.3.6",
"react-native-config": "^1.4.2",
"react-native-country-picker-modal": "^2.0.0",
"react-native-device-info": "^10.6.0",
"react-native-document-picker": "^5.3.0",
"react-native-exception-handler": "^2.10.9",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "^2.10.1",
"react-native-google-places-autocomplete": "^2.5.1",
"react-native-hyperlink": "0.0.19",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-resizer": "^1.4.5",
"react-native-keyboard-aware-scroll-view": "^0.9.3",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-lightbox": "^0.8.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.4.3",
"react-native-map-link": "^2.7.19",
"react-native-maps": "1.9.0",
"react-native-maps-directions": "^1.9.0",
"react-native-markdown-display": "^6.1.6",
"react-native-modal": "^13.0.1",
"react-native-network-info": "^5.2.1",
"react-native-offline": "^6.0.1",
"react-native-pager-view": "^5.4.15",
"react-native-paper": "^4.10.1",
"react-native-permissions": "^4.0.0",
"react-native-phone-call": "^1.0.9",
"react-native-progress": "^5.0.0",
"react-native-rate": "^1.2.4",
"react-native-ratings": "^8.1.0",
"react-native-reanimated": "3.6.2",
"react-native-safe-area-context": "^3.1.8",
"react-native-screens": "3.29.0",
"react-native-select-contact": "^1.5.0",
"react-native-sensitive-info": "^5.5.8",
"react-native-share": "10.0.2",
"react-native-simple-crypto": "^0.2.15",
"react-native-skeleton-placeholder": "^2.0.11",
"react-native-slider": "^0.11.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-status-bar-height": "^2.5.0",
"react-native-svg": "^13.4.0",
"react-native-swipe-gestures": "^1.0.5",
"react-native-tab-view": "^3.1.1",
"react-native-toast-message": "^2.1.5",
"react-native-touch-id": "^4.4.1",
"react-native-vector-icons": "9.2.0",
"react-native-video": "^5.2.0",
"react-native-view-pdf": "^0.14.0",
"react-native-vision-camera": "^4.0.0-beta.12",
"react-native-vision-camera-face-detector": "^1.4.0",
"react-native-webview": "^11.0.2",
"react-native-worklets-core": "^0.4.0",
"rn-fetch-blob": "^0.12.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/plugin-proposal-decorators": "^7.10.5",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/runtime": "^7.20.0",
"@jumpn/react-native-jetifier": "^0.1.4",
"@react-native-community/eslint-config": "^3.2.0",
"@types/enzyme": "^3.10.14",
"@types/humanize-duration": "^3.18.1",
"@types/jest": "^27.5.1",
"@types/lodash": "^4.14.161",
"@types/moment-timezone": "^0.5.30",
"@types/react": "^18.0.24",
"@types/react-lifecycles-compat": "^3.0.1",
"@types/react-native": "0.70.13",
"@types/react-native-keyboard-spacer": "^0.4.3",
"@types/react-native-permissions": "^2.0.0",
"@types/react-native-share": "^3.3.4",
"@types/react-native-tab-view": "^2.3.0",
"@types/react-native-vector-icons": "^6.4.15",
"@types/react-native-video": "^5.0.16",
"@types/react-test-renderer": "^18.0.3",
"@typescript-eslint/eslint-plugin": "5.53.0",
"@typescript-eslint/eslint-plugin-tslint": "5.53.0",
"@typescript-eslint/parser": "5.53.0",
"babel-jest": "^27.5.1",
"babel-plugin-transform-remove-console": "^6.9.4",
"chokidar-cli": "^2.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^8.19.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.11.0",
"eslint-plugin-security": "^1.5.0",
"eslint-plugin-standard": "^5.0.0",
"husky": "^4.3.0",
"jest": "^27.5.1",
"jest-sonar": "^0.2.12",
"license-checker": "^25.0.1",
"lint-staged": "^10.4.0",
"metro-react-native-babel-preset": "^0.76.9",
"postinstall-postinstall": "^2.1.0",
"react-native-clean-project": "^3.6.7",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.2.0",
"reactotron-react-native": "5.0.3",
"ts-jest": "^27.1.3",
"tslint": "^6.1.3",
"typescript": "4.9.4",
"yarn-audit-fix": "^7.1.2"
},
"resolutions": {
"@react-native/normalize-colors": "0.73.2",
"react-native": "0.71.13"
},
"husky": {
"hooks": {
"pre-commit": "tsc && lint-staged"
}
},
"lint-staged": {
"*.{ts,tsx,js,jsx}": "eslint --max-warnings=100"
}
}

[BUG ๐Ÿ›] IOS inconsistent face detection

Describe the bug:

Faces detection are inconsistent on IOS: detections logs changes from 0 to 1 then 0 again. Sometimes 2 faces are detected but with only one person in front of device's camera.

Minimum reproducible example:

Doesn't need - I'm using example app

Expected behavior:

Face detection should be consistent

I have tryed:

image.orientation = getFrameRotation(orientation: frame.orientation)

Replacing image.orientation = getFrameRotation(orientation: frame.orientation) with image.orientation = frame.orientation seems to fix the issue. (It was already fixed on 1.6.0 version).

Logs and Screenshots

running in expo dev mode (npx expo run:ios -d):

 LOG  faces 1 frame 1080 x 1920 yuv Frame
 LOG  faces 1 frame 1080 x 1920 yuv Frame
 LOG  faces 0 frame 1080 x 1920 yuv Frame
 LOG  faces 0 frame 1080 x 1920 yuv Frame
 LOG  faces 0 frame 1080 x 1920 yuv Frame
 LOG  faces 1 frame 1080 x 1920 yuv Frame
 LOG  faces 1 frame 1080 x 1920 yuv Frame
 LOG  faces 1 frame 1080 x 1920 yuv Frame
 LOG  faces 2 frame 1080 x 1920 yuv Frame
 LOG  faces 2 frame 1080 x 1920 yuv Frame
 LOG  faces 0 frame 1080 x 1920 yuv Frame
 LOG  faces 0 frame 1080 x 1920 yuv Frame
 ... they keep this exactly way floating fro 0 to 1 or 2

Device:

  • Device: Iphone 11
  • OS: IOS 17.4.1

package.json file:

Doesn't need - I'm using example app

Plugin with id 'kotlin-android' not found.[BUG]

Describe the bug
A problem occurred evaluating project ':react-native-vision-camera-face-detector'.

Plugin with id 'kotlin-android' not found.

Logs and Screenshots

  • What went wrong:
    A problem occurred evaluating project ':react-native-vision-camera-face-detector'.

Plugin with id 'kotlin-android' not found.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':react-native-vision-camera-face-detector'.

compileSdkVersion is not specified. Please add it to build.gradle

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

Smartphone (please complete the following information):

  • Vision Camera version: 4.0.1
  • react-native-vision-camera-face-detector: 1.4.0

Additional context
At the time of building project this error comes up.
Screenshot 2024-04-23 at 2 03 05โ€ฏPM

[BUG] I cant use format prop in new release. It throw error.

Describe the bug
It throw "Camera mount error [unknown/unknown: No supported surface combination is found for camera device - Id : 1. May be attempting to bind too many use cases. Existing surfaces: [] New configs: [androidx.camera.core.streamsharing.StreamSharingConfig@3f8636b, androidx.camera.core.impl.ImageAnalysisConfig@30d18ba, androidx.camera.core.impl.ImageCaptureConfig@bf25e5]]" error in new release. This doesnt happen before update other dependent packages. Maybe it may be related to them

  • Device: Huawei eve
  • OS: [e.g. iOS8.1]
  • Vision Camera version 4.0.0-beta.11
  • Face detector version 1.6.1

npx expo run:ios gives could not find module 'ExpoModulesCore' for target 'x86_64-apple-ios-simulator'

When I run

npx expo run:ios

I get this error

`โŒ (ios/Pods/Target Support Files/Pods-WinaBillion/ExpoModulesProvider.swift:8:8)

6 | */
7 |

8 | import ExpoModulesCore
| ^ could not find module 'ExpoModulesCore' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at: /Users/samsuchin/Library/Developer/Xcode/DerivedData/WinaBillion-egnnxyuhythubkgnhdlwrdpsmfoo/Build/Products/Debug-iphonesimulator/ExpoModulesCore/ExpoModulesCore.framework/Modules/ExpoModulesCore.swiftmodule
9 | import ExpoAdapterGoogleSignIn
10 | import EXConstants
11 | import ExpoCrypto

โ€บ 1 error(s), and 1 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.`

I have all the libraries installed, have my target os set to 14, and have done pod install successfully.

react-native-vision-camera-face-detector:compileDebugKotlin

Describe the bug

  • What went wrong:
    Execution failed for task ':react-native-vision-camera-face-detector:compileDebugKotlin'.

A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Compilation error. See log for more details

Expected behavior
App need to run using npm run android.

Logs and Screenshots
Screenshot 2024-04-29 at 6 32 20โ€ฏPM

Smartphone (please complete the following information):

  • Device: [e.g. Android 11]
  • Vision Camera version [e.g. 4.0.0-beta.11]
  • Face detector version [e.g. 1.6.1]
  • react-native-worklets-core: 0.4.0

Additional context
"react": "18.2.0",
"react-native": "0.73.7", // also tried in 0.71.11

Also Tried
buildscript { ext { ... kotlinVersion = "1.9.0" } dependencies { ... classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") } }
in android/build.gradle

[BUG] Downscaled face boundaries with lower photoResolution

When i use photoResolution 'max' i receive correct face boundaries,
When i use 1080 x 1920 i receive downscaled face boundaries.
How can i adjust correct scaling preferably on android side?
Thank you!

Device Mi A2 Lite
react-native-vision-camera-face-detector 1.4.0

const cameraDevice = useCameraDevice('back');
const format = useCameraFormat(cameraDevice, [
  {photoResolution: {width: 1080, height: 1920}},
]);

camera mount error [unknown/unknown: [unknown/unknown] Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29]

Describe the bug
when i try this example
https://github.com/nonam4/react-native-vision-camera-face-detector/blob/main/example/src/index.tsx

##Env :

###  platform :ANDROID, 
      
 buildToolsVersion = "34.0.0"
        minSdkVersion = 26
        compileSdkVersion = 34
        targetSdkVersion = 33
        kotlinVersion = '1.8.0'
        ndkVersion = "23.1.7779620"

### React native 
- "react-native-vision-camera": "3.9.0",
- "react-native-vision-camera-face-detector": "1.3.5",
- "react-native": "0.72.3",
-  "react-native-reanimated": "^3.4.2",
- "react-native-worklets-core": "0.3.0",

### Babel config

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    ['react-native-worklets-core/plugin'],
    [
      'react-native-reanimated/plugin',
      {
        processNestedWorklets: true
      }
    ],
  ],
};

any help please;

Original 'Frame'

Hi, is it possible to get the original 'frame: Frame' from the frameProcessor?

IOS: example not work as expected

when i start your example an IOS , i get this error ;

Frame Processor Error: Regular javascript function '' cannot be shared. Try decorating the function with the 'worklet' keyword to allow the javascript function to be used as a worklet., js engine: VisionCamera

any help?

How can I still operate on the Frame?

The plugin looks awesome btw.

Describe the bug
Hey, I am trying to use this plugin, and after I receive the data and wehn I want to access the original frame, I am able to do it, but the issue is that I am not able to execute any other frame processor plugin cause the Frame was marked as Closed. Any idea on how to solve this?

I am getting this error when I am trying to resize it:

Error: Exception in HostFunction: com.mrousavy.camera.core.FrameInvalidError: [capture/frame-invalid] Trying to access an already closed Frame! Are you trying to access the Image data outside of a Frame Processor's lifetime?

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

This is the frame processor:

    detectFaces(frame, handleFacesDetection, {
      classificationMode: 'all',
      landmarkMode: 'all',
      performanceMode: 'accurate',
      returnOriginal: true,
    });

And the callback:

if (Object.keys(result.faces).length <= 0 || !result.frame.original) {
        return;
      }
      console.log('asd1');
      const {bounds} = result.faces[0];
      const {width, height, x, y} = bounds;
      currentBounds.current = bounds;
      try {
        const resized = resize(result.frame.original, {
          scale: {
            width: 112,
            height: 112,
          },
          crop: {
            height,
            width,
            x,
            y,
          },
          rotation: '0deg',
          pixelFormat: 'rgb',
          dataType: 'uint8',
        });
        console.log(resized);
      } catch (e) {
        console.log(e);
      }

Expected behavior
A clear and concise description of what you expected to happen.

Logs and Screenshots
If applicable, add logs and/or screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Vision Camera version [e.g. 1.0.0]
  • Face detector version [e.g. 1.0.0]

Additional context
Add any other context about the problem here.

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.