导航

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

    zhang 发布的帖子

    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?

      您好,问题已解决了,是我们的代码陷入了某个死循环。谢谢您的帮助。

      发布在 OpenMV Cam
      Z
      zhang
    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?

      @kidswong999 您好,请问我们这个问题除了改变算法之外还有解决余地吗?

      发布在 OpenMV Cam
      Z
      zhang
    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?

      @kidswong999
      这是代码:
      import sensor, image, time
      from pid import PID
      import pyb

      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(100)
      sensor.set_vflip(True)
      sensor.set_hmirror(True)

      ok=0
      circles=[]
      size_threshold=500 # 保持距离的像素阈值
      x_pid = PID(p=0.5, i=1, imax=100)
      h_pid = PID(p=0.05, i=0.1, imax=50)
      uart = pyb.UART(3, 9600)

      #找视野中最大的圆
      def find_max_circle(circles):
      max_r=0
      for c in circles:
      if 5c.r()>5max_r:
      max_circle=c
      max_r=c.r()
      return max_circle

      while(True):
      img = sensor.snapshot().lens_corr(1.8)
      circles.clear()
      all_circles=img.find_circles(threshold = 2000,
      x_margin = 10, y_margin = 10, r_margin = 10,
      r_min = 2, r_max = 120)

      for c in all_circles:
      	if c.r()<22:
      		circles.append(c)
      
      if circles:
      	max_circle = find_max_circle(circles)
      	x_error = max_circle.x()-img.width()/2
      	h_error = 3.14*(max_circle.r()**2)-size_threshold
      	img.draw_circle(max_circle.x(),max_circle.y(),max_circle.r(),color = (255, 0, 0))
      	img.draw_cross(max_circle.x(), max_circle.y(),color = (255, 0, 0))
      	x_output=x_pid.get_pid(x_error,1)*0.05
      	h_output=h_pid.get_pid(h_error,1)*0.2
      	
      	if -250<h_error<250 and -25<x_error<25:
      		ok+=1
      
      	if ok>=2:
      		fan=1
      		ok=0
      
      	print("h_error:",h_error ,"h_output:",h_output,"x_output:",x_output)
      
      else:
      		pass
      发布在 OpenMV Cam
      Z
      zhang
    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?

      @kidswong999
      您好,我们现在遇到的具体情况是这样的。目前程序中只加载了PID算法和寻找视野中最大球的模块。视野内图像相对复杂时会出现死机(图像不动,编译器显示代码仍在运行)的情况。一旦视野内图像稍微复杂(例如将手伸进去)立刻死机。在简单视野长时间运行测试后,会出现一运行程序就死机的现象。
      请问这种性能严重不稳定的情况如何解决呢?
      另外,如果在你的摄像头上运行正常的话,请把你的摄像头型号告诉我好吗?我们的摄像头是open MV3。

      发布在 OpenMV Cam
      Z
      zhang
    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?

      @kidswong999
      感谢您的帮助。这份精简版的代码仅保留了寻找视野中最大圆,然后画圈圈住的功能。麻烦你再运行一下。

      发布在 OpenMV Cam
      Z
      zhang
    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?

      import sensor, image
      from pid import PID
      import pyb

      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(100)
      sensor.set_vflip(True)
      sensor.set_hmirror(True)

      circles=[]

      #找视野中最大的圆
      def find_max_circle(circles):
      max_r=0
      for c in circles:
      if 5c.r()>5max_r:
      max_circle=c
      max_r=c.r()
      return max_circle

      while(True):
      img = sensor.snapshot().lens_corr(1.8)
      circles.clear()
      all_circles=img.find_circles(threshold = 750,
      x_margin = 10, y_margin = 10, r_margin = 10,
      r_min = 2, r_max = 120)

      for c in all_circles:
      	if c.r()<22:
      		circles.append(c)
      
      if circles:
      	max_circle = find_max_circle(circles)
      	img.draw_circle(max_circle.x(),max_circle.y(),max_circle.r())
      	img.draw_cross(max_circle.x(), max_circle.y())
      else:
      	pass
      发布在 OpenMV Cam
      Z
      zhang
    • 求解释:PID算法中pulse_width_percent参数的意义是什么?

      请问各路大神,PID算法中pulse_width_percent参数的意义是什么?
      是控制电机转速的PWM波的占空比吗?如果是的话,那么在例程中x_pid的p=0.5,h_pid的p=0.05时,为什么返回的pulse_width_percent参数常常大于100呢?

      发布在 OpenMV Cam
      Z
      zhang
    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?

      麻烦您了,麻烦您了!

      发布在 OpenMV Cam
      Z
      zhang
    • RE: 摄像头运行过程中出现画面卡顿,应该怎么解决?
      import sensor, image
      from pid import PID
      import pyb
      import json
      
      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(100)
      sensor.set_vflip(True)
      sensor.set_hmirror(True)
      
      init_ok=True
      fan=0
      ok=0
      spin=0
      count_started=0
      circles=[]
      size_threshold=1100
      x_pid = PID(p=0.5, i=1, imax=100)
      h_pid = PID(p=0.05, i=0.1, imax=50)
      uart = pyb.UART(3, 9600)
      
      #找视野中最大的圆
      def find_max_circle(circles):
          max_r=0
          for c in circles:
              if 5**c.r()>5**max_r:
                  max_circle=c
                  max_r=c.r()
          return max_circle
      
      #判断是否开始接收
      while(not init_ok):
      	if uart.readline()=='Init_ok!':
      		init_ok=True
      
      while(True):
      	while(fan):
      		if uart.readline()=='get!':
      			break
      	fan=0
      
      	img = sensor.snapshot().lens_corr(1.8)
      	circles.clear()
      	all_circles=img.find_circles(threshold = 7500, 
                                       x_margin = 10, y_margin = 10, r_margin = 10,
                                       r_min = 2, r_max = 120)
      
      	for c in all_circles:
      		if c.r()<22:
      			circles.append(c)
      
      	if circles:
      		if spin:
      			count_stop()
      			spin=0
      		max_circle = find_max_circle(circles)
      		x_error = max_circle.x()-img.width()/2
      		h_error = 4*(max_circle.r()**2)-size_threshold
      		img.draw_circle(max_circle.x(),max_circle.y(),max_circle.r())
      		img.draw_cross(max_circle.x(), max_circle.y())
      		x_output=x_pid.get_pid(x_error,1)
      		h_output=h_pid.get_pid(h_error,1)
      		
      		if -250<h_error<250 and -25<x_error<25:
      			ok+=1
      
      		if ok>=2:
      			fan=1
      			ok=0
      
      		leftpwm=-h_output-x_output
      		rightpwm=-h_output+x_output
      
      		obj = {"chase":{"leftpwm" : leftpwm ,"rightpwm" : rightpwm},
      				"fan":fan,
      				"spin":spin}
      		output='$'+json.dumps(obj)+'%'
      		uart.write(output)
      	else:
      		pass
      
      发布在 OpenMV Cam
      Z
      zhang
    • 摄像头运行过程中出现画面卡顿,应该怎么解决?

      我们在调试摄像头,使之识别圆形的过程中,经常会遇到代码仍在运行,画面卡顿的现象;并且只有重新运行代码,卡顿现象才会消失。除此之外,脱机运行时,也会出现长时间无“识别成功”指令从串口传出,疑似卡顿的现象。
      请问各路大神,这种问题应该怎么改善。

      发布在 OpenMV Cam
      Z
      zhang
    • RE: OPEN MV3 camM7摄像头USB线接电脑后一直闪绿/白灯,电脑无法检测到摄像头。

      @kidswong999 您好,故障已通过DFU升级的方式解决了,感谢您的帮助。

      发布在 OpenMV Cam
      Z
      zhang
    • RE: OPEN MV3 camM7摄像头USB线接电脑后一直闪绿/白灯,电脑无法检测到摄像头。

      您好,追问一下。遇见这种情况重刷固件有用吗?在摄像头已经无法连接电脑的情况下,重刷固件是用常规升级还是DFU升级呢?

      发布在 OpenMV Cam
      Z
      zhang
    • RE: OPEN MV3 camM7摄像头USB线接电脑后一直闪绿/白灯,电脑无法检测到摄像头。

      0_1532698835215_微信图片_20180727214012.png

      发布在 OpenMV Cam
      Z
      zhang
    • RE: OPEN MV3 camM7摄像头USB线接电脑后一直闪绿/白灯,电脑无法检测到摄像头。

      使用的就是配套数据线,两台电脑都是这个情况

      发布在 OpenMV Cam
      Z
      zhang
    • OPEN MV3 camM7摄像头USB线接电脑后一直闪绿/白灯,电脑无法检测到摄像头。

      OPEN MV3 camM7摄像头USB线接电脑后一直闪绿/白灯,电脑不断循环发出接入USB和拔出USB的音效,无法检测到摄像头。用万用表测量3V3引脚电压是3.3V。请问这是出什么问题了?

      发布在 OpenMV Cam
      Z
      zhang