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

Face detection not working when image path is given from react native camera kit #33

Open
KaungHtetHein116 opened this issue Jul 30, 2023 · 5 comments
Assignees
Labels
bug Something isn't working face detection

Comments

@KaungHtetHein116
Copy link

KaungHtetHein116 commented Jul 30, 2023

When I use Image taken from React native camera kit package, even when the face is clear and have proper pixel, the face result is incorrect and it happens on ios device only.

Face detection is working properly when image is picked from device.

Here is my code for face detection.

const { uri } = await cameraRef.current.capture()
const result = await FaceDetection.detect(imagePath, { classificationMode: 'all', })

here is example image path generated by react native camera kit
Image size is 1179 × 1179 pixels

file:///private/var/mobile/Containers/Data/Application/8A87BC60-F8AC-4344-A9A2-D1ECB695BDA8/tmp/6DF288F4-D386-42FE-A51E-DF8C3C7DC6C7-7734-0000018B730F71E2.jpg

here is detail of my project

"react-native": "0.72.1"
"@react-native-ml-kit/face-detection": "^1.1.2"
"react-native-camera-kit": "^13.0.0"

@mastersandeep92
Copy link

I use Image taken from React native camera kit package, I have the Same issue on iOS Device only @KaungHtetHein116 have find any Solution ?

my Image File URI is below : -
file:///private/var/mobile/Containers/Data/Application/88D2BA48-CA30-49EE-86F6-C3014AE0C89D/tmp/B48F5191-B4BE-497B-ACEA-F2CC8F493792-3951-000001EA7FA7E978.jpg

and Face Detection Result is [ ]

here is detail of my project

"react-native": "0.72.3"
"@react-native-ml-kit/face-detection": "^1.1.2"
"react-native-camera-kit": "^13.0.0"

@KaungHtetHein116
Copy link
Author

not found the solution yet @mastersandeep92

@a7medev
Copy link
Owner

a7medev commented Sep 15, 2023

Hi everyone, thanks for reporting this issue! I'll check it and get back to you 🙏🏼

@a7medev a7medev self-assigned this Sep 15, 2023
@a7medev a7medev added face detection bug Something isn't working labels Sep 15, 2023
@OGreeni
Copy link

OGreeni commented Sep 25, 2023

Face detection is working properly when image is picked from device.

Could you give an example of a file path that worked?

@KaungHtetHein116
Copy link
Author

        import Picker, { ImageOrVideo } from 'react-native-image-crop-picker'
        import FaceDetection from '@react-native-ml-kit/face-detection'

	Picker.openPicker({})
			.then(handleSelectedImage)
			.catch(handlePermissionError)

	const handleSelectedImage = (image: ImageOrVideo) => {
		if (!hasFace(image?.path)) {
			return
		}
	}
	
	const hasFace = async (imagePath: string): Promise<boolean> => {
		setChecking(true)

		const result = await FaceDetection.detect(imagePath, {
			classificationMode: 'all',
		})

		return result?.length > 0
	}

here is the code that worked using image from device @OGreeni

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working face detection
Projects
None yet
Development

No branches or pull requests

4 participants