如何解决仅在使用Expo相机检测到的面部上开始捕获视频
我正在创建一个应用程序,该应用程序具有捕获视频并使用python flask将其发送到后端的功能,该视频将另存为帧。我正在使用世博相机捕获视频。我只想在检测到面部时才开始捕获视频。目前,我尝试使用onClick三元运算符,并且也禁用了按钮功能,该功能仅在faces.length> 0时启用,但无法使用。有人只能在检测到脸部时帮忙捕获视频吗?
const handleFacesDetected = ({ faces }) => {
if (faces.length > 0) {
setFaces(faces);
setButtonStatus(true);
}
else {
setButtonStatus(false);
return <Text>No Faces Found</Text>
}
};
相机定义
{ <Camera
style={{ flex: 1 }}
ref={ref => (camera = ref)}
type='front'
onFacesDetected={handleFacesDetected}
FaceDetectorSettings = {{
mode: FaceDetector.Constants.Mode.fast,detectLandmarks: FaceDetector.Constants.Landmarks.none,runClassifications: FaceDetector.Constants.Classifications.none,minDetectionInterval: 5000,tracking: false
}}
></Camera> }
{faces.length ? drawFace() : undefined}
</View>
<Text style={styles.countdown}>{String(countDownSeconds)}</Text>
<Text style={{alignSelf: 'center',color: "#5A5353",fontWeight: "bold"}}>Authentication In Progress.... </Text>
<View style={styles.button}>
<Button onPress={faces.length ? () => takePicture() : <Text>Please Show Face</Text>}
disabled={buttonStatus}
raised= "true"
color="#264464"
title=" Proceed"
/>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。