共 19 条结果匹配 "set_windowing",(耗时 0.01 秒)
set_windowing设置ROI后显示出来的ROI区域扭曲?
import sensor, image, time,pyb
ROI=(50,70,390,340)
sensor.reset() # 初始化摄像头
sensor.set_pixformat(sensor.RGB565) # 格式为 RGB565.
sensor.set_framesize(sensor.VGA)
sensor.set_windowing(ROI)
sensor.skip_frames(10) # 跳过10帧,使新设置生效
sensor.set_auto_whitebal(False)# Create a clock object to track the FPS.
clock = time.clock()
while(True):
img = sensor.snapshot() # Take a picture and return the image.
只识别下面和右面两个ROI区域,但是结果是只要目标物体出现在set_windowing内,就显示已经识别到
THRESHOLD = (0, 45, 19, -100, -24, 27) # Grayscale threshold for dark things...
roi1= [(0,0,80,60),
(26,45,25,11),#down
(61,27,16,8)]#right
n=0
a=0
import sensor, image, time
from pyb import LED
#LED(1).on()
#LED(2).on()
#LED(3).on()
sensor.reset()
#sensor.set_vflip(True)#垂直翻转
#sensor.set_hmirror(True)#打开水平镜像
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
sensor.set_windowing([0,0,80,60])
sensor.skip_frames(time = 2000) # WARNING: If you use QQVGA it may take seconds
clock = time.clock() # to process a frame sometimes.
while(True):
clock.tick()
down_flag=right_flag=0
img = sensor.snapshot().binary([THRESHOLD])#阈值进行二进制
line = img.get_regression([(100,100)], robust = True)#线性回归计算
for rec in roi1:
img.draw_rectangle(rec, color=(255,0,0))#颜色
if (line):
rho_err = abs(line.rho())-img.width()/2
if line.theta()>90:
theta_err = line.theta()-180
else:
theta_err = line.theta()
img.draw_line(line.line(), color = 127)#画线
#print(rho_err,line.magnitude(),rho_err)
if img.find_blobs([(0, 45, 19, -100, -24, 27)],roi=(26,45,25,11)):
down_flag=1
n=1
print(n)
if img.find_blobs([(0, 45, 19, -100, -24, 27)],roi=(61,27,16,8)):
right_flag=1
a=2
print(a)
提取画面
set_windowing(240,240)
用Apriltag做移动跟踪降落 若能实现求代码
我已经设置了set_windowing((80,90))
RuntimeError:Frame size is not supported or is not set 错误
set_windowing,里面的尺寸,必须是16的倍数。
为什么好多函数例如find_blobs等都不支持VGA格式的图像,如果想在VGA格式下使用这些函数有什么方法吗
@kidswong999 好吧,把set_windowing()函数放到skip_frames()函数前面就可以了,如果把set_windowing()放到最后就会出现我的那种情况,报格式错误。这有是什么原因呢?
openmv内存溢出
我只是将原程序中的:
pixformat
改成了grayscale
,
framesize
改成了VGA
,
skip_frames
改成了time = 1000
,
set_windowing
改成了(80,90)
,