- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个基于官方文档中的简单示例的工作代码: https://docs.expo.io/versions/latest/sdk/camera和 https://docs.expo.io/versions/latest/sdk/facedetector .
据说“在检测人脸时,FaceDetector 会发出以下形状的对象事件......”
但我不明白如何访问这些对象的值。尝试了所有可能的组合 - 没有成功。我做错了什么?有人可以帮忙吗?
当检测到人脸但无法访问数据时,会调用函数“handleFacesDetected”。
这是代码:
import React from 'react';
import { Text, View, TouchableOpacity } from 'react-native';
import { Camera, Permissions, FaceDetector } from 'expo';
export default class CameraExample extends React.Component {
state = {
hasCameraPermission: null,
type: Camera.Constants.Type.back,
};
async componentWillMount() {
const { status } = await Permissions.askAsync(Permissions.CAMERA);
this.setState({ hasCameraPermission: status === 'granted' });
}
handleFacesDetected(){
// it gets here while the face is detected. how to access the data?
}
render() {
const { hasCameraPermission } = this.state;
if (hasCameraPermission === null) {
return <View />;
} else if (hasCameraPermission === false) {
return <Text>No access to camera</Text>;
} else {
return (
<View style={{ flex: 1 }}>
<Camera
style={{ flex: 1 }}
type={this.state.type}
onFacesDetected={this.handleFacesDetected}
faceDetectorSettings={{
mode: FaceDetector.Constants.Mode.accurate,
detectLandmarks: FaceDetector.Constants.Mode.all,
runClassifications: FaceDetector.Constants.Mode.all,
}}
>
<View
style={{
flex: 1,
backgroundColor: 'transparent',
flexDirection: 'row',
}}>
<TouchableOpacity
style={{
flex: 0.1,
alignSelf: 'flex-end',
alignItems: 'center',
}}
onPress={() => {
this.setState({
type: this.state.type === Camera.Constants.Type.back
? Camera.Constants.Type.front
: Camera.Constants.Type.back,
});
}}>
<Text
style={{ fontSize: 18, marginBottom: 10, color: 'white' }}>
{' '}Flip{' '}
</Text>
</TouchableOpacity>
</View>
</Camera>
</View>
);
}
}
}
最佳答案
使用这个
handleFacesDetected = async ({ faces }) => {
if(faces.length === 1){
this.setState({ face: true });
}
}
关于javascript - Expo/RN - 获取人脸特征点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53117597/
添加 Rn,#1 ADDS Rd, Rn, #1 ARM 文档指定在第一条指令中,如果 Rd 是可选的,如果省略,则 Rd 等于 Rn。所以编译时两条指令应该是相同的。但是我们的编译器正在生成: 0x
11/04 更新: 我已经用一个应用程序创建了一个代码库,它在下面演示了这个问题。任何想要安装和使用它的人都可以在这里找到它...... https://github.com/geirman/reac
我必须从卡片列表中选择一张或两张卡片,点击每张卡片/复选框后,该卡片就会突出显示(并被选中)。每张卡上都有复选框,显示通过其进行选择的特定卡。您可以重新点击同一复选框以取消选择它。 我对原生 reac
只要帖子之间有空格,它就会显示 rn。这是我读取插入数据的方式: $content_of_post_original = mysql_real_escape_string($_POST['post_c
我正在尝试配置 Azure AD B2C 应用程序以实现 native react 并使用 this lib对于 react native 。它适用于 IOS,但对于 Android,我遇到以下错误。
我有一个水平平面列表,其中每个项目的宽度为宽度:300我想做的就是获取当前可见项目的索引。 this.handleScroll(e)} horizontal={true}
我有一个基于官方文档中的简单示例的工作代码: https://docs.expo.io/versions/latest/sdk/camera和 https://docs.expo.io/version
我想使用属性值来动态添加颜色 - 与父 View 相关。 我有以下 - © Copyright 2019 LRM Security Ltd 将通过以下方式设置样式: const copy
我的 state 对象中有一个空白数组。该数组将包含一些具有键值对的对象。 这是我的代码: import * as React from 'react'; import { Text, ScrollV
仅当作为参数传递的值为 True 使用函数返回时,我才需要在 touchableOpacity 中显示一个图标。 请指导我,因为它显示了 renderIcon() 函数的一些错误。 const Car
我已应用正确的 css 属性使容器居中,但容器仍未居中。特别是 justifyContent 和 alignItems。我不想将里面的东西居中,而只是将容器居中。我怎样才能做到这一点? functio
我正在关注 detox mocking guide与 typescript 。该应用程序始终打印 X.ts 的 console.log文件而不是 X.e2e.ts文件。 依赖版本。 react-nat
我有这段代码,当我运行该程序时,我得到的只是白屏。没有错误,我可以看到我的日志,所以我知道程序呈现并运行。我的猜测是, 存在一些问题。风格,但我无法解决这个问题。 所以这里的逻辑是,我基本上在渲染 V
我的 RN 应用程序中有以下代码。 handleTextChange = e => { this.setState({ value: e }) } 我使用 TS,这表示“参数 'e' 隐式具有 '
我正在实现自己的模块,但在快速将参数传递到函数中时遇到问题。该函数应该返回 Promise。它总是因这个错误而崩溃 异常“getPassesOf:不是可识别的 Objective-C 方法。”在使用参
我们经常使用这些术语。但为何如此命名尚不清楚。 最佳答案 Rd:目标寄存器 Rn:寄存器中用于算术运算的操作数。 Rm:寄存器中用于算术运算的操作数。 Ra:寄存器中用于加法或减法的值。想想“蓄能器”
如何在 React Native Flatlist 中列出 2 列,例如: 最佳答案 只需通过 Prop numColumns到您的 FlatList 组件。 关于react-native - RN
我正在实现自己的模块,但在快速将参数传递到函数中时遇到问题。该函数应该返回 Promise。它总是因这个错误而崩溃 异常“getPassesOf:不是可识别的 Objective-C 方法。”在使用参
我们经常使用这些术语。但为何如此命名尚不清楚。 最佳答案 Rd:目标寄存器 Rn:寄存器中用于算术运算的操作数。 Rm:寄存器中用于算术运算的操作数。 Ra:寄存器中用于加法或减法的值。想想“蓄能器”
最近我检查了 ARM Cortex-M3 处理器的指令集。 例如: ADD , , 这些缩写到底是什么意思? 我猜他们的意思是不同类型的地址,比如直接寻址、相对寻址等等。 但究竟是什么? 谢谢! 最
我是一名优秀的程序员,十分优秀!