导航

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

    18229941233 发布的帖子

    • 色块跟踪实验为什么要关掉白平衡?

      色块跟踪实验为什么要关掉白平衡?

      发布在 OpenMV Cam
      1
      18229941233
    • RE: 两个MV之间通信怎么清空接收方UART.ANY()里的数据从而重新查询。

      @kidswong999 在 两个MV之间通信怎么清空接收方UART.ANY()里的数据从而重新查询。 中说:

      uart.read(timeout_char=0)

      0_1525671065372_5.7.jpg
      但是报错了大佬。

      发布在 OpenMV Cam
      1
      18229941233
    • 两个MV之间通信怎么清空接收方UART.ANY()里的数据从而重新查询。
      
      import sensor, image, time
      from pyb import UART
      from pyb import Servo
      import cpufreq
      import pyb
      threshold_index = 0 # 0 for red, 1 for green, 2 for blue
      
      # Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
      # The below thresholds track in general red/green/blue things. You may wish to tune them...
      thresholds = [(58, 88, 57, -4, 20, 70)] # generic_red_thresholds
                                                  # generic_green_thresholds
                                                  # generic_blue_thresholds
      threshold2 = [(30, 47, -39, 19, 20, 42)]
      avg=[0,0,0,0,0,0,0,0,0,0,0,0]
      sort2_servo=Servo(1)
      led = pyb.LED(3)
      #cpufreq.set_frequency(cpufreq.CPUFREQ_216MHZ)
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()
      
      # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
      # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
      # camera resolution. "merge=True" merges all overlapping blobs in the image.
      
      uart=UART(3,115200)
      
      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
      
      ROI=(0,0,1,1)
      
      while(True):
          data = 0
          clock.tick()
          img = sensor.snapshot()
          sort2_servo.angle(-900)
          time.sleep(20)
          #time.sleep(10)
          blobs = img.find_blobs([thresholds[0]], pixels_threshold=80, area_threshold=850, merge=True)
          if blobs:
                    max_blob = find_max(blobs)
                    ROI = max_blob.rect()
                    xc = max_blob.cx()
                    yc = max_blob.cy()
                    x = max_blob.x()
                    y = max_blob.y()
                    xn = int(xc-(xc-x)*7/10)
                    yn = int(yc-(yc-y)*7/10)
                    wn = (xc-xn)*2
                    hn = (yc-yn)*2
                    ROI = (xn, yn, wn, hn)
                    img.binary(thresholds)
                    #Bimg.erode(2)
                    #img.dilate(1)
                    statistics=img.get_statistics(roi=ROI)
                    avg = statistics.mean()
                    print(avg)
                    if(uart.any()):
                         data = uart.readline()
                         
                    if ( data!=0):#avg>=50 and avg<=95 or
                        print("bad")
                        print(data)
                        print(uart.any())
                        #led.on()
                        #time.sleep(150)
                        #ed.off()
                        sort2_servo.angle(0)       #添加时期2018.4.20
                        time.sleep(1000)        #添加时期2018.4.20
                        sort2_servo.angle(-900)           #添加时期2018.4.20
                        time.sleep(1000)        #添加时期2018.4.20
                        data = 0
                    elif (avg>95):
                        sort2_servo.angle(-900)           #添加时期2018.4.20
                        time.sleep(100)
                        print("good")
                        print(uart.any())
          #print(clock.fps())
          #print(cpufreq.get_frequency())
      
      
      发布在 OpenMV Cam
      1
      18229941233
    • RE: ROI取值float转换成int型怎么做?

      我想把xn,yn变成Int型怎么做?我试了一下int(xn)得到的还是浮点数

      发布在 OpenMV Cam
      1
      18229941233
    • ROI取值float转换成int型怎么做?
      # Single Color RGB565 Blob Tracking Example
      #
      # This example shows off single color RGB565 tracking using the OpenMV Cam.
      
      import sensor, image, time
      
      threshold_index = 0 # 0 for red, 1 for green, 2 for blue
      
      # Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
      # The below thresholds track in general red/green/blue things. You may wish to tune them...
      thresholds = [(100, 37, -40, 127, 12, 127)] # generic_red_thresholds
                                                  # generic_green_thresholds
                                                  # generic_blue_thresholds
      threshold2 = [(30, 47, -39, 19, 20, 42)]
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()
      
      # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
      # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
      # camera resolution. "merge=True" merges all overlapping blobs in the image.
      
      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
      
      ROI=(0,0,1,1)
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          blobs = img.find_blobs([thresholds[0]], pixels_threshold=800, area_threshold=800, merge=False)
          if blobs:
                    max_blob = find_max(blobs)  
                    print(max_blob.rect())
                   #img.draw_rectangle(max_blob.rect())
                   #img.draw_cross(max_blob.cx(), max_blob.cy())
                    ROI = max_blob.rect()
                    xc = max_blob.cx()
                    yc = max_blob.cy()
                    x = max_blob.x()
                    y = max_blob.y()
                    xn = xc-(xc-x)*8/10
                    int(xn)
                    yn = yc-(yc-y)*8/10
                    int(yn)
                    wn = (xc-xn)*2
                    int(wn)
                    hn = (yc-yn)*2
                    int(hn)
                    ROI = (xn, yn, wn, hn)
          img.binary(thresholds)
          img.dilate(2, threshold = 10)
          statistics=img.get_statistics(roi=ROI)
          avg = statistics.mean()
          print(avg)
          print(clock.fps())
      
      发布在 OpenMV Cam
      1
      18229941233
    • openmv接两个大舵机,舵机转动工作的时候抖动地厉害

      openmv接两个大舵机,舵机转动工作的时候抖动地厉害,我怀疑是细分的不好,不知道大伙怎么看,可不可以进到函数里面赶下舵机的精度?

      发布在 OpenMV Cam
      1
      18229941233
    • RE: openmv的模块库下载

      可不可以先整理出超声波的。。。(^~^)!!!,或者在群里发一下?在网上找得例程感觉崩了。。。。55555

      发布在 OpenMV Cam
      1
      18229941233
    • openmv的模块库下载

      我在星瞳的教程上发现了这个网址https://github.com/SingTown/OpenMV-lib
      教程上说这个网址里有各个模块库的例程,但我没看到,是跑到哪里去了?

      发布在 OpenMV Cam
      1
      18229941233
    • RE: openmv怎么接红外寻迹模块和超声波避障模块呢?

      大佬mv做超声波搞好了吗?可以分享下嘛?我的搞不出来。。。

      发布在 OpenMV Cam
      1
      18229941233
    • RE: pixformat is not supported是怎么回事?

      @yuan
      超声波测距print出来的全部是0,就算没加屏幕显示都不对,这是啥原因呢?

      发布在 OpenMV Cam
      1
      18229941233
    • RE: openmv怎么用超声波测距?

      @kidswong999
      从网上找得资料,做的一个超声波测距,但是print的全是0,这是怎么回事,可以帮忙看下吗?还有上面的网站打不开
      #openmv利用超声波测距
      import time,utime,pyb
      from pyb import Pin

      wave_echo_pin = Pin('P7', Pin.IN, Pin.PULL_NONE)
      wave_trig_pin = Pin('P8', Pin.OUT_PP, Pin.PULL_DOWN)

      wave_distance = 0
      tim_counter = 0
      flag_wave = 0

      #超声波启动
      def wave_start():
      wave_trig_pin.value(1)
      utime.sleep_us(15)
      wave_trig_pin.value(0)

      #超声波距离计算
      def wave_distance_calculation():
      #全局变量声明
      global tim_counter
      #频率f为0.2MHZ 高电平时间t=计数值1/f
      wave_distance = tim_counter
      5*0.017
      #输出最终的测量距离(单位cm)
      print('wave_distance',wave_distance)

      #超声波数据处理
      def wave_distance_process():
      global flag_wave
      if(flag_wave == 0):
      wave_start()
      if(flag_wave == 2):
      wave_distance_calculation()
      flag_wave = 0

      #配置定时器
      tim =pyb.Timer(1, prescaler=720, period=65535) #相当于freq=0.2M

      #外部中断配置
      def callback(line):
      global flag_wave,tim_counter
      #上升沿触发处理
      if(wave_echo_pin.value()):
      tim.init(prescaler=720, period=65535)
      flag_wave = 1
      #下降沿
      else:
      tim.deinit()
      tim_counter = tim.counter()
      tim.counter(0)
      extint.disable()
      flag_wave = 2
      #中断配置
      extint = pyb.ExtInt(wave_echo_pin, pyb.ExtInt.IRQ_RISING_FALLING, pyb.Pin.PULL_DOWN, callback)

      while(True):
      wave_distance_process()
      time.sleep(100)
      print('wave_distance',wave_distance)
      如果要在图像上显示,总是提示pix format错误,要怎么解决呢?

      发布在 OpenMV Cam
      1
      18229941233
    • openmv怎么用超声波测距?

      openmv怎么用超声波测距?

      发布在 OpenMV Cam
      1
      18229941233
    • pixformat is not supported是怎么回事?

      import pyb, sensor, image, math, time, utimesensor.reset()#openmv初始化sensor.set_framesize(sensor.QVGA)#设置图像大小sensor.set_pixformat(sensor.GRAYSCALE)from pyb import Pinwave_echo_pin = Pin('P7', Pin.IN , Pin.PULL_NONE)wave_trig_pin = Pin('P8', Pin.OUT_PP, Pin.PULL_DOWN)wave_distance = 0tim_counter = 0flag_wave = 0#超声波启动def wave_start(): wave_trig_pin.value(1) utime.sleep_us(15) wave_trig_pin.value(0)#超声波距离计算def wave_distance_calculation(): #全局变量声明 global tim_counter #频率f为0.2MHZ 高电平时间t=计数值1/f wave_distance = tim_counter5*0.017 #输出最终的测量距离(单位cm) print('wave_distance',wave_distance)#超声波数据处理def wave_distance_process(): global flag_wave if(flag_wave == 0): wave_start() if(flag_wave == 2): wave_distance_calculation() flag_wave = 0#配置定时器tim =pyb.Timer(1, prescaler=720, period=65535) #相当于freq=0.2M#外部中断配置def callback(line): global flag_wave,tim_counter #上升沿触发处理 if(wave_echo_pin.value()): tim.init(prescaler=720, period=65535) flag_wave = 1 #下降沿 else: tim.deinit() tim_counter = tim.counter() tim.counter(0) extint.disable() flag_wave = 2#中断配置extint = pyb.ExtInt(wave_echo_pin, pyb.ExtInt.IRQ_RISING_FALLING, pyb.Pin.PULL_DOWN, callback)while(True): wave_distance_process() time.sleep(100) for i in range(10): img = sensor.snapshot() for j in range(100): img.draw_string(50, 0, "space:",color=[255,0,0]) img.draw_string(50, 10, str(wave_distance),color=[255,0,0]) img.draw_string(100, 10, "CM",color=[255,0,0])

      发布在 OpenMV Cam
      1
      18229941233
    • RE: 怎么用杜邦线向OPENMV提供5V电源?谢谢。

      @kidswong999
      我用直流电源提供了5V,负端接GND,正极接VIN。通电的时候,MV闪了一下白灯,是一闪而过的那种闪。 不像USB口供电那样,MV闪俩下绿灯,然后晾一下白灯。咋回事

      发布在 OpenMV Cam
      1
      18229941233
    • RE: WIFI传图做色块识别,手机上看不到框框怎办

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

      发布在 OpenMV Cam
      1
      18229941233
    • RE: 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")
      
      发布在 OpenMV Cam
      1
      18229941233
    • WIFI传图做色块识别,手机上看不到框框怎办

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

      发布在 OpenMV Cam
      1
      18229941233
    • 怎么用杜邦线向OPENMV提供5V电源?谢谢。

      怎么用杜邦线向OPENMV提供5V电源?谢谢。

      发布在 OpenMV Cam
      1
      18229941233