Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
detectFaces = (picture: string) => {
this.setState({
faceDetection: {
detecting: true,
faces: [],
},
});
FaceDetector.detectFacesAsync(picture, {
mode: FaceDetector.Constants.Mode.accurate,
detectLandmarks: FaceDetector.Constants.Landmarks.all,
runClassifications: FaceDetector.Constants.Classifications.none,
})
.then(result => {
this.setState({
faceDetection: {
detecting: false,
faces: result.faces,
image: result.image,
},
});
})
.catch(error => {
this.setState({
faceDetection: {
detecting: false,
faces: [],
detectFace = () =>
FaceDetector.detectFacesAsync(this.props.uri, {
detectLandmarks: FaceDetector.Constants.Landmarks.none,
runClassifications: FaceDetector.Constants.Classifications.all,
})
.then(this.facesDetected)
.catch(this.handleFaceDetectionError)
detectFaces = (picture: string) => {
this.setState({
faceDetection: {
detecting: true,
faces: [],
},
});
FaceDetector.detectFacesAsync(picture, {
mode: FaceDetector.Constants.Mode.accurate,
detectLandmarks: FaceDetector.Constants.Landmarks.all,
runClassifications: FaceDetector.Constants.Classifications.none,
})
.then(result => {
this.setState({
faceDetection: {
detecting: false,
faces: result.faces,
image: result.image,
},
});
})
.catch(error => {
this.setState({
faceDetection: {
detecting: false,
detectFace = () =>
FaceDetector.detectFacesAsync(this.props.uri, {
detectLandmarks: FaceDetector.Constants.Landmarks.none,
runClassifications: FaceDetector.Constants.Classifications.all,
})
.then(this.facesDetected)
.catch(this.handleFaceDetectionError)
detectFace = photoUri =>
FaceDetector.detectFacesAsync(`${FileSystem.documentDirectory}photos/${photoUri}`, {
detectLandmarks: FaceDetector.Constants.Landmarks.none,
runClassifications: FaceDetector.Constants.Classifications.all,
})
.then(this.facesDetected)
.catch(this.handleFaceDetectionError);
detectFace = photoUri =>
FaceDetector.detectFacesAsync(`${FileSystem.documentDirectory}photos/${photoUri}`, {
detectLandmarks: FaceDetector.Constants.Landmarks.none,
runClassifications: FaceDetector.Constants.Classifications.all,
})
.then(this.facesDetected)
.catch(this.handleFaceDetectionError);
detectFace = () =>
FaceDetector.detectFacesAsync(this.props.uri, {
detectLandmarks: FaceDetector.Constants.Landmarks.none,
runClassifications: FaceDetector.Constants.Classifications.all,
})
.then(this.facesDetected)
.catch(this.handleFaceDetectionError)
detectFaces = (picture: string) => {
this.setState({
faceDetection: {
detecting: true,
faces: [],
},
});
FaceDetector.detectFacesAsync(picture, {
mode: FaceDetector.Constants.Mode.accurate,
detectLandmarks: FaceDetector.Constants.Landmarks.all,
runClassifications: FaceDetector.Constants.Classifications.none,
})
.then(result => {
this.setState({
faceDetection: {
detecting: false,
faces: result.faces,
image: result.image,
},
});
})
.catch(error => {
this.setState({
faceDetection: {
detectFace = photoUri =>
FaceDetector.detectFacesAsync(`${FileSystem.documentDirectory}photos/${photoUri}`, {
detectLandmarks: FaceDetector.Constants.Landmarks.none,
runClassifications: FaceDetector.Constants.Classifications.all,
})
.then(this.facesDetected)
.catch(this.handleFaceDetectionError);