导航

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

    nxq5

    @nxq5

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

    nxq5 关注

    nxq5 发布的帖子

    • 我调用了圆形识别例子,想通过wifi方式将直径传输到电脑,我把这两个结合了,请问如何修改参数?

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

      SSID ='OPENMV_AP' # Network SSID
      KEY ='1234567890' # Network key (must be 10 chars)
      HOST = '' # Use first available interface
      PORT = 8080 # Arbitrary non-privileged port

      yellow_threshold = ( 0, 8, -9, -0, 0, 10)

      Reset sensor

      sensor.reset()

      Set sensor settings

      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)
      #识别历程添加
      sensor.skip_frames(10) # Let new settings take affect.
      sensor.set_auto_whitebal(False) # turn this off.

      Init wlan module in AP mode.

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

      You can block waiting for client to connect

      #print(wlan.wait_for_sta(10000))

      def response(s):
      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: application/json\r\n" \
                  "Cache-Control: no-cache\r\n" \
                  "Pragma: no-cache\r\n\r\n")
      
      # FPS clock
      clock = time.clock()
      
      # Start streaming images
      # NOTE: Disable IDE preview to increase streaming FPS.
      

      #添加圆形识别例子
      k=260
      k2=0.1154

      while(True):
      clock.tick() # Track elapsed milliseconds between snapshots().
      img = sensor.snapshot() # Take a picture and return the image.

      blobs = img.find_blobs([yellow_threshold])
      if len(blobs) == 1:
          # Draw a rect around the blob.
          b = blobs[0]
          img.draw_rectangle(b[0:4]) # rect
          img.draw_cross(b[5], b[6]) # cx, cy
          Lm = (b[2]+b[3])/2
          length = K/Lm
          #print(length)
          #print(Lm)
          size=k2*Lm
          print("直径为",size)
      

      #传输数据
      client.send(json.dumps(blobs))
      client.close()

      while (True):
      # Create server socket
      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(3)
          response(s)
      except OSError as e:
          s.close()
          print("socket error: ", e)
          #sys.print_exception(e)
      发布在 OpenMV Cam
      N
      nxq5
    • RE: socket error: 134681419

      @把握今天 请问你当初的问题解决了吗?我目前也遇到类似的问题,想请教下

      发布在 OpenMV Cam
      N
      nxq5
    • RE: socket error: 134681419

      @kidswong999 请问关于socket编程的知识,在哪里偶遇呀,想学习下

      发布在 OpenMV Cam
      N
      nxq5
    • 运行圆形识别代码并同步无心啊传输数据,socket error 返回-13 什么意思,如何解决?

      0_1587473461830_批注 2020-04-21 205042.png

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

      SSID ='OPENMV_AP' # Network SSID
      KEY ='1234567890' # Network key (must be 10 chars)
      HOST = '' # Use first available interface
      PORT = 8080 # Arbitrary non-privileged port

      green_threshold = ( 0, 80, -70, -10, -0, 30)

      Reset sensor

      sensor.reset()

      Set sensor settings

      sensor.set_contrast(3)
      sensor.set_brightness(1)
      sensor.set_saturation(1)
      sensor.set_gainceiling(16)
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.VGA)

      sensor.set_windowing((320, 240))

      Init wlan module in AP mode.

      wlan = network.WINC(mode=network.WINC.MODE_AP)

      Init wlan module in Download mode.

      #wlan = network.WINC(mode=network.WINC.MODE_FIRMWARE)

      For ATWINC1500-MR210PB only.

      #wlan.fw_update("/winc_19_6_1.bin")

      wlan.start_ap(SSID, key=KEY, security=wlan.WEP, channel=2)

      You can block waiting for client to connect

      #print(wlan.wait_for_sta(10000))

      def response(s):
      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: application/json\r\n" \
                  "Cache-Control: no-cache\r\n" \
                  "Pragma: no-cache\r\n\r\n")
      
      # FPS clock
      clock = time.clock()
      
      # Start streaming images
      # NOTE: Disable IDE preview to increase streaming FPS.
      
      img = sensor.snapshot()
      blobs = img.find_blobs([green_threshold])
      if blobs:
          for b in blobs:
              img.draw_rectangle(b[0:4]) # rect
              img.draw_cross(b[5], b[6]) # cx, cy
      
      client.send(json.dumps(blobs))
      client.close()
      

      while (True):
      # Create server socket
      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(3)
          response(s)
      except OSError as e:
          s.close()
          print("socket error: ", e)
          #sys.print_exception(e)
      发布在 OpenMV Cam
      N
      nxq5
    • RE: 为什么我把OpenMV插到云台/wifi模块上,运行程序没反应?

      为什么我焊脚焊接了,显示faile to set framesize

      发布在 OpenMV Cam
      N
      nxq5