查找色块的源码
find_blobs函数具体怎样实现?
blob源码是先找到阈值进行二值化,然后利用基于扫描线的洪水填充法查找连通域?在这过程把x.y.w.h统计了?还是怎样实现的?
想看OpenMV程序源码
请问哪里可以看到OpenMV3里面功能函数的实现源码?比如人脸识别、色块识别这些的具体实现过程的程序,而不单单是封装好的功能函数?
源代码执行出问题
import sensor, image, time
from pid import PID
from pyb import Servo
pan_servo=Servo(1)
tilt_servo=Servo(2)
red_threshold = (13, 49, 18, 61, 6, 47)
pan_pid = PID(p=0.07, i=0, imax=90) #脱机运行或者禁用图像传输,使用这个PID
tilt_pid = PID(p=0.05, i=0, imax=90) #脱机运行或者禁用图像传输,使用这个PID
#pan_pid = PID(p=0.1, i=0, imax=90)#在线调试使用这个PID
#tilt_pid = PID(p=0.1, i=0, imax=90)#在线调试使用这个PID
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.
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() # Track elapsed milliseconds between snapshots().
img = sensor.snapshot() # Take a picture and return the image.
blobs = img.find_blobs([red_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
pan_output=pan_pid.get_pid(pan_error,1)/2
tilt_output=tilt_pid.get_pid(tilt_error,1)
print("pan_output",pan_output)
pan_servo.angle(pan_servo.angle()+pan_output)
tilt_servo.angle(tilt_servo.angle()-tilt_output)
这是怎磨回事
openmv源码的工作原理
大佬好,就比如我用C点亮一个LED,那我编译载入32,32执行; 那我现在micropython写一句点亮LED,那这句话到真正执行点亮led这个操作,这中间的过程究竟是怎么样的呢?学生党表示搞不清楚细节,非常苦恼啊。 在omv ide使用micropython开发完,只是将.py文件copy进flash,并没有编译啊, 等于一切最终执行都是依赖于一开始烧进的固件啊。。 这中间的过程究竟是怎样的,请大佬赐教
舵机云台开源代码
在openmv的教程3中说舵机云台的代码是开源的,我在官网里没有找到,请问在哪里有舵机云台的代码?
有openmv4 lepton3.5的源代码嘛
请求代码。。。。。。
openmv编译源码失败,求解?
编译时报的错误
在执行sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa时的错误
执行sudo apt-get install gcc-arm-embedded时的提示
是否在安装的时候需要翻墙,这个错误是不是由于没有翻墙导致ppa更新失败导致的
关于错误:RuntimeError: Sensor Timeout!!
问题描述:
我现在想要编写一段程序,实现以下功能:程序初始化以后关闭感光元件,等待外部中断的到来,外部中断接收到以后启动定时器,12秒以后关闭定时器,并且再次关闭感光元件,而while循环主要就是通过一个变量判断是否进行采图工作。现在程序能实现接收外部中断,并启动定时器,而且能够在12秒以后在terminal中打印出sleep_flag = 1的语句(证明定时器能够正常工作),但打印完以后马上跳出来一个错误:
Traceback (most recent call last):
File "
RuntimeError: Sensor Timeout!!
请教一下各位,这是什么原因引起的呢?应该如何解决呢?谢谢!
程序源码:
import sensor, image, time, pyb
# -----</Definition of variables>-----
sleep_flag = 1
index_i = 0
time_1s = 0
TIME_ONEMIN_INSEC = 12
RED_LED_PIN = 1
GREEN_LED_PIN = 2
BLUE_LED_PIN = 3
# <Definition of variables/>------------------------------------------------------------
sensor.reset() # 重置并初始化传感器。
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Capture frames for 2000ms.
pyb.LED(RED_LED_PIN).on()
time.sleep(1000)
pyb.LED(RED_LED_PIN).off()
sensor.sleep(True) # 启用传感器睡眠模式(节省约40mA)
# -----</Definition of Clock object>-----
clock = time.clock()
# </Definition of Clock object>---------------------------------------------------------
# -----</Creation of mjpeg object>-----
#???
# <Creation of mjpeg object/>-----------------------------------------------------------
# -----</Timer>-----
def tick_4(timer):
global time_1s
global sleep_flag
time_1s = time_1s + 1
print('time_1s =', time_1s)
if time_1s >= TIME_ONEMIN_INSEC:
time_1s = 0
sleep_flag = 1
print("sleep_flag =", sleep_flag)
sensor.sleep(True)
timer.deinit()
# defination of timer_4
tim_4 = pyb.Timer(4, freq = 1)
tim_4.deinit()
#tim_4.callback(tick_4)
# <Timer/>------------------------------------------------------------------------------
# -----</External interrupt>-----
def ext_callback(line):
global index_i
global sleep_flag
global time_1s
global tim_4
print("line =", line)
index_i = index_i + 1;
print("No.", index_i)
sensor.reset() # 重置并初始化传感器。
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Capture frames for 2000ms.
time_1s = 0
tim_4.init(freq = 1)
tim_4.callback(tick_4)
print("Timer_4 has been activated!")
if sleep_flag == 1:
sleep_flag = 0
#else:
# sleep_flag = 1
# Falling edge triger
extint = pyb.ExtInt(pyb.Pin('P8'), pyb.ExtInt.IRQ_FALLING, pyb.Pin.PULL_UP, ext_callback)
# <External interrupt/>-----------------------------------------------------------------
# Recording up to 5min, then sleep again
while (True):
if sleep_flag == 0:
sensor.snapshot()