导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. k1zq
    K
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    k1zq

    @k1zq

    0
    声望
    29
    楼层
    1203
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    k1zq 关注

    k1zq 发布的帖子

    • RE: OSError: 32,代码运行时的错误,求大佬指点

      对的,认识的人脸会输出人脸编号,不认识的会输出不认识,然后拍照保存到SD卡里,然后WiFi图传,我代码的意思是运行人脸识别的同时WiFi图传,然后可以在网页上看到,但现在只能看到一张,好像帧缓存区会卡住,还有什么别的方法WiFi图传吗?教程上的是将帧缓存区的图像压缩然后传输

      发布在 OpenMV Cam
      K
      k1zq
    • RE: OSError: 32,代码运行时的错误,求大佬指点

      我是想实现通过特征点检测人脸,不认识的人脸拍照保存到SD卡的unknown person 文件夹里,然后在通过将图片读取的帧缓存区WiFi图传,在网页上看,结果运行到第一张图片的时候,第一张图可以在网页上看到,然后两秒钟左右就出现这个错误了,第二张图片在帧缓存区是失真的

      发布在 OpenMV Cam
      K
      k1zq
    • RE: OSError: 32,代码运行时的错误,求大佬指点

      我是从SD卡里读取图片然后通过WiFi传输,同时进行人脸识别

      发布在 OpenMV Cam
      K
      k1zq
    • RE: OSError: 32,代码运行时的错误,求大佬指点

      大佬帮帮忙,真不知道为什么,第一张图还能查看,第二张的时候帧缓存区就图失真了

      发布在 OpenMV Cam
      K
      k1zq
    • RE: OSError: 32,代码运行时的错误,求大佬指点

      @k1zq 在 OSError: 32,代码运行时的错误,求大佬指点 中说:

          client.send(cframe)
      

      0_1618217766015_7c2fc80f-0c6e-4ab2-a4a6-d7f3444162bf-image.png

      发布在 OpenMV Cam
      K
      k1zq
    • OSError: 32,代码运行时的错误,求大佬指点
      pmax=0
      num=1
      n=1
      loop_flag=1
      
      SSID ='OPENMV_AP'    # Network SSID
      KEY  ='1234567890'    # Network key (must be 10 chars)
      HOST = ''           # Use first available interface
      PORT = 8080         # Arbitrary non-privileged port
      
      wlan = network.WINC(mode=network.WINC.MODE_AP)
      wlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)     
        
      s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
      # try:
      # Bind and listen
      s.bind([HOST, PORT])
      s.listen(5)
      
          # Set server socket timeout
          # NOTE: Due to a WINC FW bug, the server socket must be closed and reopened if
          # the client disconnects. Use a timeout here to close and re-create the socket.
      #s.settimeout(10)
      print ('Waiting for connections..')
      client, addr = s.accept()
          # set client socket timeout to 2s
      client.settimeout(2.0)
      print ('Connected to ' + addr[0] + ':' + str(addr[1]))
      
          # Read request from client
      data = client.recv(1024)
          # Should parse client request here
      
          # Send multipart header
      client.send("HTTP/1.1 200 OK\r\n" \
                  "Server: OpenMV\r\n" \
                  "Content-Type: image/jpeg\r\n\r\n")
      
      while loop_flag:
          #加了histeq子自适应直方图均衡,当人脸填满整个屏幕的时候可以提高一点点识别准确度.histeq(adaptive=True, clip_limit=3)
          #找图片中人脸
          #gamma_corr用于修正图像中色彩,数值越高图像越亮
          faces = sensor.snapshot().gamma_corr(contrast=1.5).find_features(image.HaarCascade("frontalface"))
          #仅当图片中有人脸(正脸)才裁切脸部分,并进行特征点比对判断
          print("Gain %f dB, Exposure %d us" % \
              (sensor.get_gain_db(), sensor.get_exposure_us()))
          if faces:
              pyb.LED(3).on()
              pyb.LED(3).off()
              loop_flag=0
                  #获取image中人像部分largest_face的roi
              largest_face = max(faces, key = lambda f: f[3] * f[3])
              img=sensor.get_fb().crop(roi=largest_face)#裁剪人脸部分保存到img
      
      
              kpts1=img.find_keypoints(max_keypoints=90, threshold=0, scale_factor=1.3)
      
              #img.draw_keypoints(kpts)#画出此时的目标特征,没有调用那个定义的函数
              img.draw_keypoints(kpts1)
      
                  #下面进行特征点比对
              kpts2=None
              for s in range(1, NUM_SUBJECTS+1):
                  match_count = int(0)
                  angle_count=0
                  for i in range(2, NUM_SUBJECTS_IMGS+1):
                      kpts2=image.load_descriptor("/keypoints/s%s/%s.orb"%(s,i))
      
                          #匹配当前找到的特征和最初的目标特征的相似度
                          # #threshold阈值设置匹配的准确度,用来过滤掉有歧义的匹配。这个值越小,准确度越高。阈值范围0~100,默认70
                          #filter_outliers默认关闭。
                          #对于ORB描述符来说,这个函数返回的是kptmatch对象。
                      match_count+=image.match_descriptor(kpts1, kpts2).count()
                          #match=image.match_descriptor(kpts1, kpts2)
                          #if isinstance(match,kptmatch):+
                          #    match_count+=match.count()
      
                          #angle_count+=image.match_descriptor(kpts1, kpts2).theta()
      
                  print("Average match_count for subject %d: %d"%(s, match_count/NUM_SUBJECTS_IMGS))
      
                  pmax=find_max(pmax, match_count/NUM_SUBJECTS_IMGS, s)#match_count越大,被检测人脸与此样本更相似更匹配。
                      #print("pmax:%d"%pmax)
      
              if pmax<9:#和三个人都差距都较大,返回0
                      #buneng
                      #uart.write(str(0))
                  print("unknown person !") # face_num保存s中当前最匹配的人的编号。
                  pyb.LED(1).on()
                  sensor.reset()
                  # Set sensor settings
      
                  sensor.set_framesize(sensor.QVGA)
                  sensor.set_pixformat(sensor.RGB565)
                  sensor.snapshot().save("unknow person/%s.bmp" % (num) )
                  num+=1
      
                  pyb.LED(1).off()
              else:
                      #uart.write(str(face_num))#发送只能是字符,而不能是数字,所以需要格式转换str(b)
                  print("The most similar person is:%d"%face_num) # face_num保存s中当前最匹配的人的编号。
                  pyb.LED(2).on()
                  sensor.skip_frames(time = 1000)
                  pyb.LED(2).off()
      
          else:
              print("find no face")
              frame = image.Image("unknow person/%s.bmp" % (n), copy_to_fb=True)
              cframe = frame.compressed(quality=35)
              client.send(cframe)
      
              client.close()
              n+=1
              sensor.skip_frames(time = 2000)
      发布在 OpenMV Cam
      K
      k1zq
    • RE: wifi传输图片问题。希望大佬回复

      WiFi图传浏览器只能看一张图片吗?

      发布在 OpenMV Cam
      K
      k1zq
    • wifi传输图片问题。希望大佬回复

      可以传输多张图片,然后在网址上看到这些图片,不是教程里的一张

      发布在 OpenMV Cam
      K
      k1zq
    • RE: wifi怎么传输图片到阿里云网页服务器上?

      请问现在解决了吗

      发布在 OpenMV Cam
      K
      k1zq
    • 请教一下运行方面的问题?

      0_1617810105269_1fbb1c06-5d91-4e8d-8895-a528526176a3-image.png
      点运行一直显示这个
      这是输入,有什么问题吗?
      import sensor, time, image, pyb, tf, os, math

      from pyb import UART
      from pid import PID
      from pyb import Servo

      发布在 OpenMV Cam
      K
      k1zq