导航

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

    e5i2 发布的帖子

    • 定时器初始化之后就会一直计时,有没有方法让它暂停计时,等待下一次唤醒?

      定时器初始化之后就会一直计时,有没有方法让它暂停计时,等待下一次唤醒?

      发布在 OpenMV Cam
      E
      e5i2
    • Timer(2, prescaler=83, period=999)是多少秒?

      Timer(2, prescaler=83, period=999)是多少秒?

      发布在 OpenMV Cam
      E
      e5i2
    • RE: wifi模块怎么接收数据?用网络调试助手可以给wifi模块发数据吗?

      @kidswong999 在 wifi模块怎么接收数据?用网络调试助手可以给wifi模块发数据吗? 中说:

      https://docs.python.org/zh-cn/3/library/stdtypes.html#bytes

      感谢!!!

      发布在 OpenMV Cam
      E
      e5i2
    • RE: wifi模块怎么接收数据?用网络调试助手可以给wifi模块发数据吗?

      没发送数据给data,使用print(data)显示的是b'';发送数据123给data,使用print(data)显示的是b'123';它多了b'',是接收函数配置的类型,还是格式?

      发布在 OpenMV Cam
      E
      e5i2
    • RE: wifi模块怎么接收数据?用网络调试助手可以给wifi模块发数据吗?

      请问要怎么解析从客户端接收到数据呢?

      发布在 OpenMV Cam
      E
      e5i2
    • 请问在AP模式下怎么查看自己的IP地址和端口号?

      请问在AP模式下怎么查看自己的IP地址和端口号?

      发布在 OpenMV Cam
      E
      e5i2
    • wifi模块有详细的使用教程吗?

      wifi模块有详细的使用教程吗?

      发布在 OpenMV Cam
      E
      e5i2
    • wifi模块怎么接收数据?用网络调试助手可以给wifi模块发数据吗?

      我跑的是无线图传的例程,里面的
      # 从客户端读取请求
      data = client.recv(1024)
      显示的是接收数据吗?

      发布在 OpenMV Cam
      E
      e5i2
    • RE: openMV的ESP8266在AP模式下怎么接收数据?

      无线图传的例程能接收数据吗?

      发布在 OpenMV Cam
      E
      e5i2
    • RE: openMV的ESP8266在AP模式下怎么接收数据?

      使用wifi模块实现了无线图传,在这个基础上在接收一段数据

      发布在 OpenMV Cam
      E
      e5i2
    • openMV的ESP8266在AP模式下怎么接收数据?

      openMV的ESP8266在AP模式下怎么接收数据?

      发布在 OpenMV Cam
      E
      e5i2
    • WIFI无线图传Connected to 192.168.1.100:44620是怎么回事?

      代码:
      import sensor, image, time, network, usocket, sys, pyb

      SSID ='OPENMV_AP' # Network SSID
      KEY ='1234567890' # wifi密码(必须为10字符)
      HOST = '' # 使用第一个可用的端口
      PORT = 8080 # 任意非特权端口

      在AP模式下启动wlan模块。

      wlan = network.WINC(mode=network.WINC.MODE_AP)
      wlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)

      配置WIFI并传输视频流

      def start_streaming(s):
      # 重置传感器
      sensor.reset()
      # 设置传感器设置
      sensor.set_contrast(1)
      sensor.set_brightness(1)
      sensor.set_saturation(1)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.QQVGA)
      sensor.set_pixformat(sensor.RGB565)

      print ('Waiting for connections..')
      client, addr = s.accept()
      # 将客户端套接字超时设置为2秒
      client.settimeout(2.0)
      print ('Connected to ' + addr[0] + ':' + str(addr[1]))
      
      # 从客户端读取请求
      data = client.recv(1024)
      # 应该在这里解析客户端请求
      
      # 发送多部分head
      client.send("HTTP/1.1 200 OK\r\n" \
                  "Server: OpenMV\r\n" \
                  "Content-Type: multipart/x-mixed-replace;boundary=openmv\r\n" \
                  "Cache-Control: no-cache\r\n" \
                  "Pragma: no-cache\r\n\r\n")
      
      # FPS clock
      clock = time.clock()
      
      # 开始人脸识别
      facial_identification()
      # 开始分辨人脸
      temp = Distinguish_faces()
      
      if (temp == 0):
          # 开始流媒体图像
          #注:禁用IDE预览以增加流式FPS。
          while (True):
              clock.tick() # 跟踪snapshots()之间经过的毫秒数。
              frame = sensor.snapshot()
              cframe = frame.compressed(quality=35)
              header = "\r\n--openmv\r\n" \
                       "Content-Type: image/jpeg\r\n"\
                       "Content-Length:"+str(cframe.size())+"\r\n\r\n"
              client.send(header)
              client.send(cframe)
              print(clock.fps())
      
              # 直到接受到信号(WIFI接受的信号/延时信号)在退出视频流传输
              # return 0
      
      else:
          return 0
      

      人脸识别

      def facial_identification():
      # 感光元件设置
      sensor.set_contrast(3)
      sensor.set_gainceiling(16)
      # HQVGA and GRAYSCALE are the best for face tracking.
      # HQVGA和灰度对于人脸识别效果最好
      sensor.set_framesize(sensor.HQVGA)
      sensor.set_pixformat(sensor.GRAYSCALE)
      # 注意人脸识别只能用灰度图哦

      # 加载Haar算子
      # 默认情况下,这将使用所有阶段,更低的satges更快,但不太准确。
      face_cascade = image.HaarCascade("frontalface", stages=25)
      # image.HaarCascade(path, stages=Auto)加载一个haar模型。haar模型是二进制文件,
      # 这个模型如果是自定义的,则引号内为模型文件的路径;也可以使用内置的haar模型,
      # 比如“frontalface” 人脸模型或者“eye”人眼模型。
      # stages值未传入时使用默认的stages。stages值设置的小一些可以加速匹配,但会降低准确率。
      print(face_cascade)
      
      # FPS clock
      clock = time.clock()
      
      while (True):
          clock.tick()
      
          # 拍摄一张照片
          img = sensor.snapshot()
      
          # Find objects.
          # Note: Lower scale factor scales-down the image more and detects smaller objects.
          # Higher threshold results in a higher detection rate, with more false positives.
          objects = img.find_features(face_cascade, threshold=0.75, scale=1.35)
          # image.find_features(cascade, threshold=0.5, scale=1.5),thresholds越大,
          # 匹配速度越快,错误率也会上升。scale可以缩放被匹配特征的大小。
      
          # h = None  # 用于判断是否识别到人脸
          # 在找到的目标上画框,标记出来
          for r in objects:
              img.draw_rectangle(r)  # 在找到的目标上画框,标记出来
              # h = 1
              # return h
              return 0
      

      分辨人脸

      def Distinguish_faces():
      sensor.reset() # Initialize the camera sensor.
      sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
      sensor.set_framesize(sensor.B128X128) # or sensor.QQVGA (or others)
      sensor.set_windowing((92, 112))
      sensor.skip_frames(10) # Let new settings take affect.
      sensor.skip_frames(time=5000) # 等待5s

      # SUB = "s1"
      NUM_SUBJECTS = 3  # 图像库中不同人数,一共3人
      NUM_SUBJECTS_IMGS = 10  # 每人有20张样本图片
      
      # 拍摄当前人脸。
      img = sensor.snapshot()
      # img = image.Image("singtown/%s/1.pgm"%(SUB))
      d0 = img.find_lbp((0, 0, img.width(), img.height()))
      # d0为当前人脸的lbp特征
      img = None
      pmin = 15000
      num = 0
      
      def min(pmin, a, s):
          global num
          if a < pmin:
              pmin = a
              num = s
          return pmin
      
      for s in range(1, NUM_SUBJECTS + 1):
          dist = 0
          for i in range(2, NUM_SUBJECTS_IMGS + 1):
              img = image.Image("singtown/s%d/%d.pgm" % (s, i))
              d1 = img.find_lbp((0, 0, img.width(), img.height()))
              # d1为第s文件夹中的第i张图片的lbp特征
              dist += image.match_descriptor(d0, d1)  # 计算d0 d1即样本图像与被检测人脸的特征差异度。
          print("Average dist for subject %d: %d" % (s, dist / NUM_SUBJECTS_IMGS))
          pmin = min(pmin, dist / NUM_SUBJECTS_IMGS, s)  # 特征差异度越小,被检测人脸与此样本更相似更匹配。
          print(pmin)
      
      print(num)  # num为当前最匹配的人的编号。
      if (num == 1 or num == 2 or num == 3):
          # 使电磁失效(待补充)
          print("认证成功")
      else:
          num = 0
      
      return int(num)
      

      主函数

      def main_s():

      while (True):
      # 创建服务器套接字
      s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
      try:
      # Bind and listen
      s.bind([HOST, PORT])
      s.listen(5)

          # 设置服务器套接字超时
          # 注意:由于WINC FW bug,如果客户端断开连接,服务器套接字必须
          # 关闭并重新打开。在这里使用超时关闭并重新创建套接字。
          s.settimeout(3)
          start_streaming(s)
      except OSError as e:
          s.close()
          print("socket error: ", e)
          #sys.print_exception(e)
      

      开始运行

      main_s()

      运行结果:
      Waiting for connections..
      socket error: -13
      Waiting for connections..
      Connected to 192.168.1.100:44620
      {"width":24, "height":24, "n_stages":25, "n_features":2913, "n_rectangles":6383}

      发布在 OpenMV Cam
      E
      e5i2
    • RE: WIFI无线图传初始化lcd.init()后为什么就不能正常工作了?

      已近明白了,谢谢!

      发布在 OpenMV Cam
      E
      e5i2
    • WIFI无线图传初始化lcd.init()后为什么就不能正常工作了?

      MJPEG Streaming AP.

      这个例子展示了如何在AccessPoint模式下进行MJPEG流式传输。

      Android上的Chrome,Firefox和MJpegViewer App已经过测试。

      连接到OPENMV_AP并使用此URL:http://192.168.1.1:8080查看流。

      import sensor, image, time, network, usocket, sys, lcd

      SSID ='OPENMV_AP' # Network SSID
      KEY ='1234567890' # wifi密码(必须为10字符)
      HOST = '' # 使用第一个可用的端口
      PORT = 8080 # 任意非特权端口

      重置传感器

      sensor.reset()

      设置传感器设置

      sensor.set_contrast(1)
      sensor.set_brightness(1)
      sensor.set_saturation(1)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.QQVGA2)
      sensor.set_pixformat(sensor.RGB565)

      在AP模式下启动wlan模块。

      wlan = network.WINC(mode=network.WINC.MODE_AP)
      wlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)

      lcd.init()

      def LCD_S(a):

      # for temp in range(0,24):
          # lcd.display(a)
      

      #您可以阻止等待客户端连接
      #print(wlan.wait_for_sta(10000))
      def start_streaming(s):
      print ('Waiting for connections..')
      client, addr = s.accept()
      # 将客户端套接字超时设置为2秒
      client.settimeout(2.0)
      print ('Connected to ' + addr[0] + ':' + str(addr[1]))

      # 从客户端读取请求
      data = client.recv(1024)
      # 应该在这里解析客户端请求
      
      # 发送多部分head
      client.send("HTTP/1.1 200 OK\r\n" \
                  "Server: OpenMV\r\n" \
                  "Content-Type: multipart/x-mixed-replace;boundary=openmv\r\n" \
                  "Cache-Control: no-cache\r\n" \
                  "Pragma: no-cache\r\n\r\n")
      
      # FPS clock
      clock = time.clock()
      
      # lcd.init()
      
      # 开始流媒体图像
      #注:禁用IDE预览以增加流式FPS。
      while (True):
          clock.tick() # 跟踪snapshots()之间经过的毫秒数。
          frame = sensor.snapshot()
          cframe = frame.compressed(quality=35)
          header = "\r\n--openmv\r\n" \
                   "Content-Type: image/jpeg\r\n"\
                   "Content-Length:"+str(cframe.size())+"\r\n\r\n"
          client.send(header)
          client.send(cframe)
          print(clock.fps())
          # LCD_S(frame)
          lcd.display(frame)
      

      while (True):
      # 创建服务器套接字
      s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
      try:
      # Bind and listen
      s.bind([HOST, PORT])
      s.listen(5)

          # 设置服务器套接字超时
          # 注意:由于WINC FW bug,如果客户端断开连接,服务器套接字必须
          # 关闭并重新打开。在这里使用超时关闭并重新创建套接字。
          s.settimeout(3)
          start_streaming(s)
      except OSError as e:
          s.close()
          print("socket error: ", e)
          #sys.print_exception(e)
      发布在 OpenMV Cam
      E
      e5i2
    • RE: WIFI无线图传,传输视频流。一直报socket error:-13。

      @kidswong999 已贴出代码和错误

      发布在 OpenMV Cam
      E
      e5i2
    • RE: WIFI无线图传,传输视频流。一直报socket error:-13。

      代码:

      # MJPEG Streaming AP.
      #
      # 这个例子展示了如何在AccessPoint模式下进行MJPEG流式传输。
      # Android上的Chrome,Firefox和MJpegViewer App已经过测试。
      # 连接到OPENMV_AP并使用此URL:http://192.168.1.1:8080查看流。
      
      import sensor, image, time, network, usocket, sys
      
      SSID ='OPENMV_AP'    # Network SSID
      KEY  ='1234567890'   # wifi密码(必须为10字符)
      HOST = ''           # 使用第一个可用的端口
      PORT = 8080         # 任意非特权端口
      
      # 重置传感器
      sensor.reset()
      # 设置传感器设置
      sensor.set_contrast(1)
      sensor.set_brightness(1)
      sensor.set_saturation(1)
      sensor.set_gainceiling(16)
      sensor.set_framesize(sensor.QQVGA)
      sensor.set_pixformat(sensor.RGB565)
      
      # 在AP模式下启动wlan模块。
      wlan = network.WINC(mode=network.WINC.MODE_AP)
      wlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)
      
      #您可以阻止等待客户端连接
      #print(wlan.wait_for_sta(10000))
      
      def start_streaming(s):
          print ('Waiting for connections..')
          client, addr = s.accept()
          # 将客户端套接字超时设置为2秒
          client.settimeout(2.0)
          print ('Connected to ' + addr[0] + ':' + str(addr[1]))
      
          # 从客户端读取请求
          data = client.recv(1024)
          # 应该在这里解析客户端请求
      
          # 发送多部分head
          client.send("HTTP/1.1 200 OK\r\n" \
                      "Server: OpenMV\r\n" \
                      "Content-Type: multipart/x-mixed-replace;boundary=openmv\r\n" \
                      "Cache-Control: no-cache\r\n" \
                      "Pragma: no-cache\r\n\r\n")
      
          # FPS clock
          clock = time.clock()
      
          # 开始流媒体图像
          #注:禁用IDE预览以增加流式FPS。
          while (True):
              clock.tick() # 跟踪snapshots()之间经过的毫秒数。
              frame = sensor.snapshot()
              cframe = frame.compressed(quality=35)
              header = "\r\n--openmv\r\n" \
                       "Content-Type: image/jpeg\r\n"\
                       "Content-Length:"+str(cframe.size())+"\r\n\r\n"
              client.send(header)
              client.send(cframe)
              print(clock.fps())
      
      while (True):
          # 创建服务器套接字
          s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
          try:
              # Bind and listen
              s.bind([HOST, PORT])
              s.listen(5)
      
              # 设置服务器套接字超时
              # 注意:由于WINC FW bug,如果客户端断开连接,服务器套接字必须
              # 关闭并重新打开。在这里使用超时关闭并重新创建套接字。
              s.settimeout(3)
              start_streaming(s)
          except OSError as e:
              s.close()
              print("socket error: ", e)
              #sys.print_exception(e)
      

      错误:
      socket error:-13

      发布在 OpenMV Cam
      E
      e5i2
    • WIFI无线图传,传输视频流。一直报socket error:-13。

      我将sensor.set_pixformat(sensor.GRAYSCALE)里的GRAYSCALE按照视频里的操作改成RGB565后运行就一直报socket error:-13。请问这是什么原因?

      发布在 OpenMV Cam
      E
      e5i2
    • RE: 如何使用OpenMV进行口罩识别,求方法指导

      同求。。。。。。。。

      发布在 OpenMV Cam
      E
      e5i2
    • 运行分辨人脸例程时断言失败

      0_1602267305141_捕获.PNG

      发布在 OpenMV Cam
      E
      e5i2