收藏
回答

微信小程序调用相机,支持调整相机焦距吗

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 需求 camera 客户端 7.04 2.0.4

- 需求的场景描述(希望解决的问题)

微信小程序调用相机,支持调整相机焦距吗


- 希望提供的能力


最后一次编辑于  2019-04-25
回答关注问题邀请回答
收藏

3 个回答

  • 马风新
    马风新
    2019-09-06

    希望小程序可以通过api自动调整相机焦距

    2019-09-06
    有用 4
    回复
  • 老衲洗头用飘柔
    老衲洗头用飘柔
    发表于移动端
    2021-10-18
    2021-10-18
    有用
    回复
  • 疯狂的小辣椒
    疯狂的小辣椒
    2019-04-28

    是指手指触摸上去放大缩小?

    2019-04-28
    有用
    回复 4
    • 三少爷🎈
      三少爷🎈
      2019-04-28

      不知道能不能通过代码控制·

      现在我试过手指触摸只能放大  不能缩小

      2019-04-28
      回复
    • 疯狂的小辣椒
      疯狂的小辣椒
      2019-04-28回复三少爷🎈

      目前无相关API支持

      2019-04-28
      回复
    • 三少爷🎈
      三少爷🎈
      2019-04-28回复疯狂的小辣椒

      有没有间接的办法来解决焦距远近的问题

            <view class='camera_view'>
              <camera device-position="front" flash="off" binderror="error" class="camera" bindstop='bindstop' binderror='binderror'></camera>
            </view>
       
       
      //人脸确认
      takePhoto: function (e) {
        wx.showLoading({
          title: '加载中',
        })
       
        let that = this
        let ctx = wx.createCameraContext()
        var account = wx.getStorageSync('account');
       
        ctx.takePhoto({
          quality: 'low',
          success: (res) => {
            console.log(res.tempImagePath)
            that.setData({
              src: res.tempImagePath
            })
       
            wx.getFileSystemManager().readFile({
              filePath: res.tempImagePath, //选择图片返回的相对路径
              encoding: 'base64', //编码格式
              success: res => { //成功的回调
                console.log(1111);
                var base64 = res.data; //base64编码
                var face_url = app.globalData.urlPath3 + '/avatar/' + account.face;
                var info = [
                  {
                    "image": face_url,
                    "image_type": "URL",
                    "face_type": "LIVE",
                    "quality_control": "LOW",
                    "liveness_control": "HIGH"
                  },
                  {
                    "image": base64,
                    "image_type": "BASE64",
                    "face_type": "LIVE",
                    "quality_control": "LOW",
                    "liveness_control": "HIGH"
                  }
                ];
                console.log(info);
                wx.request({
                  url: 'https://aip.baidubce.com/rest/2.0/face/v3/match?access_token=' + that.data.access_token,
                  data: info,
                  method: 'POST',
                  header: { 'content-type': 'application/json' },
                  success: function (res) {
                    console.log(res);
                    wx.hideLoading();
       
                    if (res.data.error_msg != "SUCCESS" || res.data.result.score < 80) {
                      console.log("识别失败");
                      wx.showToast({
                        title: '人脸不一致,不能继续考试!',
                        icon: "none",
                        duration: 2000
                      })
                    } else {
                      that.setData({
                        camera_comfirm: false,
                        wrap_hide: false,
                      })
       
                      var exam_id = that.data.exam_id;
                      var name = that.data.name;
                      var exam_score = that.data.exam_score;
                      var pass_score = that.data.pass_score;
                      var questionCount = that.data.questionCount;
                      var time_limit = that.data.time_limit;
                      var end_time = that.data.end_time;
                      var start_time = that.data.start_time;
                      wx.navigateTo({
                        url: '../exam/examTo?exam_id=' + exam_id + '&name=' + name + '&exam_score=' + exam_score + '&pass_score=' + pass_score + '&questionCount=' + questionCount + '&time_limit=' + time_limit + '&end_time=' + end_time + '&start_time=' + start_time,
                      })
       
                    }
       
       
                  },
                })
              }
            })
          }
        })
       
      },


      2019-04-28
      回复
    • Charles
      Charles
      2019-08-21
      请问现在还有支持么
      2019-08-21
      回复
登录 后发表内容