百度人脸检测:https://console.bce.baidu.com/ai/?fromai=1#/ai/face/overview/index
免费资源包用完需要付费。
1、百度开通人脸检测
创建应用:https://console.bce.baidu.com/ai/?fromai=1#/ai/face/app/list
新建组->新建用户
实名认证->领取“人脸检测”资源:https://console.bce.baidu.com/ai/#/ai/face/overview/resource/getFree
2、uni
微信小程序:uni.createCameraContext()
0、展示
<up-modal :show="show" title="人脸检测" @confirm="close()">
<view class="slot-content">
<!-- "front"表示使用前置摄像头、"back"表示使用后置摄像头,高度不能太小 -->
<camera device-position="front" flash="off" style="width: 300px; height: 300px;border-radius: 50%;"></camera>
</view>
</up-modal>
// 使用 reactive 创建响应式状态
const state = reactive({
baiduApiData: {
apikey: '', // 创建应用时生成
SecretKey: '' // 创建应用时生成
},
access_token: '',
base64Img: '',
// 检测到人脸的照片
baseImage: ''
});
// 弹窗
const show = ref(false);
const close = () => {
sh