问题描述
我正在创建一个应用程序,该应用程序具有捕获视频并使用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 (将#修改为@)