• OpenMV VSCode 扩展发布了,在插件市场直接搜索OpenMV就可以安装
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • WIFI传图做色块识别,手机上看不到框框怎办



    • 手机上看不到把色块框起来的框框



    • 需要编写程序的,你把你的程序贴一下



    • 此回复已被删除!


    • @kidswong999

      import sensor, image, time, network, usocket, sys
      from pyb import UART,LED
      
      uart = UART(3, 1382400) #设置串口波特率
      uart.init(1382400,timeout_char=100)
      
      green_threshold   = ((42, 78, 34, 82, 0, 63))#目标颜色
      
      # 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)
      sensor.set_auto_whitebal(False) # turn this off.
      #sensor.set_auto_gain(False)
      clock = time.clock()
      
      def find_max(blobs):
          max_size=0
          for blob in blobs:
              if blob[2]*blob[3] > max_size:
                  max_blob=blob
                  max_size = blob[2]*blob[3]
          return max_blob
      
      #等待接收客服端连接成功
      while(uart.readchar()!=43):
          print("connect...")
      #连接成功LED显示
      LED(1).on()
      time.sleep(2000)
      uart.write("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\nend")
      # FPS clock
      time.sleep(4000)
      # Start streaming images
      # NOTE: Disable IDE preview to increase streaming FPS.
      
      
      
      while (True):
          clock.tick() # Track elapsed milliseconds between snapshots().
          img = sensor.snapshot()
      
          cframe = img.compressed(quality=35)
      
          header = "\r\n--openmv\r\n" \
                   "Content-Type: image/jpeg\r\n"\
                   "Content-Length:"+str(cframe.size())+"\r\n\r\n"
          blobs = img.find_blobs([green_threshold])
          if blobs:
              max_blob = find_max(blobs)
              pan_error = max_blob.cx()-img.width()/2
              tilt_error = max_blob.cy()-img.height()/2
              print("pan_error: ", pan_error)
              img.draw_rectangle(max_blob.rect()) # rect
              img.draw_cross(max_blob.cx(), max_blob.cy()) # cx, cy
          uart.write(header)
          uart.write(cframe)
          uart.write("end")
      


    • cframe = img.compressed(quality=35)

      这一句,需要放在后面,需要在draw_rectangle/draw_cross后面,才可以让画出框框的图像发送出去。



    • 谢谢你,我以后会常来这提问。谢谢。