导航

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

    3icr

    @3icr

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

    3icr 关注

    3icr 发布的帖子

    • openmv在识别色块中为什么一直出现这种错误

      0_1565200113088_捕获.PNG

      
      import sensor, image, time
      
      line_threshold = (2, 51, -21, 65, -17, 18)
      
      sensor.reset()
      
      sensor.set_pixformat(sensor.RGB565)
      
      sensor.set_framesize(sensor.QVGA)
      
      sensor.skip_frames(10)
      
      sensor.set_auto_whitebal(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(True):
          clock.tick()
          img = sensor.snapshot()
          blobs = img.find_blobs([line_threshold], x_stride=10)
          if blobs:
                  max_blob=find_max(blobs)
                  if int(max_blob.w()/max_blob.h())>5 and max_blob.w()>200:
                      img.draw_rectangle(max_blob[0:4])
                      img.draw_cross(max_blob[5], max_blob[6])
                      print(max_blob[5], max_blob[6])
                      print(clock.fps())
      
      
      发布在 OpenMV Cam
      3
      3icr
    • openmv在光流的绝对旋转变换例程中,出现完美的夹具,这个夹具具体是指什么

      1_1565014197985_3.PNG 0_1565014197981_2.PNG

      # 光流绝对旋转变换示例
      
      #
      
      # 此示例显示使用OpenMV Cam通过将当前图像与先前图像相互比较来测量旋转/缩放。 
      
      # 请注意,在此模式下仅处理旋转/缩放 - 而不是X和Y平移。
      
      
      
      # 要有效地运行此演示,请将OpenMV安装在稳固的底座上,
      
      # 然后 慢慢地 围绕镜头旋转摄像机,并向前/向后移动摄像机以查看数字的变化。
      
      # 即仅改变z方向。
      
      
      
      import sensor, image, time, math
      
      
      
      # 注意!!! 使用find_displacement()时,必须使用2的幂次方分辨率。 
      
      # 这是因为该算法由称为相位相关的东西提供动力,该相位相关使用FFT进行图像比较。 
      
      # 非2的幂次方分辨率要求填充到2的幂,这降低了算法结果的有用性。 
      
      # 请使用像B64X64或B64X32这样的分辨率(快2倍)。
      
      
      
      # 您的OpenMV Cam支持2的幂次方分辨率64x32,64x64,128x64和128x128。
      
      # 如果您想要32x32的分辨率,可以通过在64x64图像上执行“img.pool(2,2)”来创建它。
      
      
      
      sensor.reset()                      # Reset and initialize the sensor.
      
      sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
      
      sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)...
      
      sensor.skip_frames(time = 2000)     # Wait for settings take effect.
      
      clock = time.clock()                # Create a clock object to track the FPS.
      
      
      
      # 从主帧缓冲区的RAM中取出以分配第二帧缓冲区。
      
      # 帧缓冲区中的RAM比MicroPython堆中的RAM多得多。
      
      # 但是,在执行此操作后,您的某些算法的RAM会少得多......
      
      # 所以,请注意现在摆脱RAM问题要容易得多。
      
      extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)
      
      extra_fb.replace(sensor.snapshot())
      
      
      
      while(True):
      
          clock.tick() # Track elapsed milliseconds between snapshots().
      
          img = sensor.snapshot() # Take a picture and return the image.
      
      
      
          # 如果没有完美的夹具,这个算法很难测试......所以,这是一个让它看起来有效的骗子...
      
          # 在下面输入一个z_rotation值,你应该看到r的输出等于它。
      
          if(0):
      
              expected_rotation = 20.0
      
              img.rotation_corr(z_rotation=expected_rotation)
      
      
      
          # 如果没有完美的夹具,这个算法很难测试......所以,这是一个让它看起来有效的骗子...
      
          # 在下面输入一个z_rotation值,你应该看到r的输出等于它。
      
          if(0):
      
              expected_zoom = 0.8
      
              img.rotation_corr(zoom=expected_zoom)
      
      
      
          # 对于此示例,我们从不更新旧图像以测量绝对变化。
      
          displacement = extra_fb.find_displacement(img, logpolar=True)
      
      
      
          # 没有滤波,偏移结果是嘈杂的,所以我们降低了一些精度。
      
          rotation_change = int(math.degrees(displacement.rotation()) * 5) / 5.0
      
          zoom_amount = displacement.scale()
      
      
      
          if(displacement.response() > 0.1): # 低于0.1左右(YMMV),结果只是噪音。
      
              print("{0:+f}r {1:+f}z {2} {3} FPS".format(rotation_change, zoom_amount, \
      
                    displacement.response(),
      
                    clock.fps()))
      
          else:
      
              print(clock.fps())
      
      发布在 OpenMV Cam
      3
      3icr
    • openmv在运行的过程中,电脑端画面突然白屏

      openmv在使用的时候,突然会出现白屏
      0_1564811149487_捕获.PNG

      发布在 OpenMV Cam
      3
      3icr
    • RE: openmv收数据的问题

      视频看完了,问题还没解决

      发布在 OpenMV Cam
      3
      3icr
    • openmv收数据的问题

      当openmv的串口没有收到数据时,为什么print函数一直现实的是一

      # Blob Detection and uart transport
      
      import sensor, image, time,pyb
      
      from pyb import UART
      
      import json
      
      # For color tracking to work really well you should ideally be in a very, very,
      
      # very, controlled enviroment where the lighting is constant...
      
      yellow_threshold   = (65, 100, -10, 6, 24, 51)
      
      # You may need to tweak the above settings for tracking green things...
      
      # Select an area in the Framebuffer to copy the color settings.
      
      
      
      #sensor.reset() # Initialize the camera sensor.
      
      #sensor.set_pixformat(sensor.RGB565) # use RGB565.
      
      #sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.
      
      #sensor.skip_frames(10) # Let new settings take affect.
      
      #sensor.set_auto_whitebal(False) # turn this off.
      
      clock = time.clock() # Tracks FPS.
      
      led = pyb.LED(3) 
      
      uart = UART(3, 9600)
      
      i=0
      
      while(True):
          i=uart.readchar()
          b=int(uart.readchar())
          
          print(b) 
      
      

      0_1562721125494_捕获.PNG

      发布在 OpenMV Cam
      3
      3icr
    • openmv中云台中pid函数有一点看不懂,请求指点

      openmv中云台中pid函数中,有一处“output += error * self._kp ”,self._kp的值一直为零,那么output的值也一直为零,此时pid函数的意义何在?我实在看不懂,请求指点

      from pyb import millis
      from math import pi, isnan
      class PID:
      	_kp = _ki = _kd = _integrator = _imax = 0  
      	_last_error = _last_derivative = _last_t = 0  #定义私有属性
          _RC = 1/(2 * pi * 20)
      	def __init__(self, p=0, i=0, d=0, imax=0):     #前后双下划线,魔法属性
      		self._kp = float(p)
      		self._ki = float(i)
      		self._kd = float(d)
      		self._imax = abs(imax)
      		self._last_derivative = float('nan')     #最常见的计算有 无穷大 减 无穷大 结果为 nan
      	def get_pid(self, error, scaler):
      		tnow = millis()                           #插件重置后,返回毫秒数。
      		dt = tnow - self._last_t                  #这次时间与上次时间的差
      		output = 0
      		if self._last_t == 0 or dt > 1000:
      			dt = 0
      			self.reset_I()
      		self._last_t = tnow
      		delta_time = float(dt) / float(1000)
      		output += error * self._kp               #self.kp=0,output=0?
      		if abs(self._kd) > 0 and dt > 0:
      			if isnan(self._last_derivative):
      				derivative = 0
      				self._last_derivative = 0
      			else:
      				derivative = (error - self._last_error) / delta_time
      			derivative = self._last_derivative + \
      									 ((delta_time / (self._RC + delta_time)) * \
      										(derivative - self._last_derivative))
      			self._last_error = error
      			self._last_derivative = derivative
      			output += self._kd * derivative
      		output *= scaler
      		if abs(self._ki) > 0 and dt > 0:
      			self._integrator += (error * self._ki) * scaler * delta_time
      			if self._integrator < -self._imax: self._integrator = -self._imax
      			elif self._integrator > self._imax: self._integrator = self._imax
      			output += self._integrator
      		return output
      	def reset_I(self):
      		self._integrator = 0
      		self._last_derivative = float('nan')
      ![0_1562652603774_捕获.PNG](https://fcdn.singtown.com/00f312db-c421-456d-bfe0-726c28b68fdb.PNG) 
      
      发布在 OpenMV Cam
      3
      3icr
    • RE: openmv中pid函数一直报错

      @kidswong999 一直弄不好
      比较着急

      发布在 OpenMV Cam
      3
      3icr
    • RE: openmv中pid函数一直报错

      @kidswong999 那应该是怎么弄

      发布在 OpenMV Cam
      3
      3icr