星瞳实验室APP,快速收到回复
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • WINC WiFi模块传输图片滞后一张?



    • 我想实现拍一张照片,再实时传输到浏览器,如此不断循环,所以先进行单次测试,拍一张传一张,发四次。
      但是,看浏览器结果像是第一次不知道传输了什么,第二次传输了1.jpg,第三次传输了2.jpg,第四次传输了3.jpg,结束。
      再添加重复代码也是类似的情况,会有一张的差距,我想问是什么原因造成的,怎么才能实时传输图片?

      测试采用IDE 2.4.0例程mjpeg_streamer,手机和openmv连接同一个WiFi,手机用UC浏览器连接IP:8080
      代码中
      import pyb #用于延时
      将传输部分

          while (True):
              clock.tick() # Track elapsed milliseconds between 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())
      

      替换为四段重复代码

          num=0  
          
          num+=1
          frame = sensor.snapshot()
          frame.draw_string(5, 0, "%02d"%num, color = (128, 0, 0), scale = 2, mono_space = False)
          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(num)
          pyb.delay(3000)
      
          num+=1
          frame = sensor.snapshot()
          frame.draw_string(5, 0, "%02d"%num, color = (128, 0, 0), scale = 2, mono_space = False)
          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(num)
          pyb.delay(3000)
          
          num+=1
          frame = sensor.snapshot()
          frame.draw_string(5, 0, "%02d"%num, color = (128, 0, 0), scale = 2, mono_space = False)
          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(num)
          pyb.delay(3000)
          
          num+=1
          frame = sensor.snapshot()
          frame.draw_string(5, 0, "%02d"%num, color = (128, 0, 0), scale = 2, mono_space = False)
          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(num)
          pyb.delay(3000)
      
          while True:pass