共 499 条结果匹配 "sensor",(耗时 0.04 秒)
如何识别一幅画面中指定的区域的色块
https://forum.singtown.com/topic/276/如何使用roi来设定有效检测区域
可以直接在sensor里设置ROI参数,或者在find_blobs里设置ROI参数。
Openmv cam H7 故障 无限重新连接电脑
买了两个Openmv cam H7, 其中有一个完好,另外一个无法运行有关sensor库的程序,可以运行简单控制led 程序,一旦运行“hello world”,led就会狂闪绿灯,然后白灯,然后无限重新连接电脑。
openmv的库函数怎么在电脑上打开查看?比如image,sensor库等
我想问的是,写了import sensor这样的语句后,实际运行的过程中,解释器会去什么地方找对应的代码?C++是编译的过程中找,Python在Windows上是找对应的.py文件,那microPython在哪找呢?
摄像头给电脑的图像偏绿,弄不清楚为什么?
请在这里粘贴代码
import pyb
import sensor, image, time, math
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
while(True):
#拍摄一张照片
img = sensor.snapshot()
只想打印其中一条直线的x1分量(比如打印第一个直线的x1),如何加代码?
enable_lens_corr = False # turn on for straighter lines...打开以获得更直的线条…
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.RGB565) #灰度更快
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
min_degree = 0
max_degree = 179
while(True):
clock.tick()
img = sensor.snapshot()
if enable_lens_corr: img.lens_corr(1.8) # for 2.8mm lens...
lines = img.find_lines(threshold = 1000, theta_margin = 25, rho_margin = 25)
if lines:
line = lines[0]
print(line.x1())
由模板匹配模板弄的识别物体回传坐标,但不能返回坐标值,想问怎么样能实现模板匹配或者特征点检测画出矩形框后得出中心坐标?
import time, sensor, image
from image import SEARCH_EX, SEARCH_DS
sensor.reset()
sensor.set_contrast(1)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.QQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
template = image.Image("/template.pgm")
clock = time.clock()
while (True):
clock.tick()
img = sensor.snapshot()
r = img.find_template(template, 0.70, step=4, search=SEARCH_EX)
if r:
img.draw_rectangle(r)
x = r[0]
y = r[1]
w = r[2]
h = r[3]
cx = x + w/2
cy = y + h/2
print(cx, cy)
print(clock.fps())
扫码选择这个if该怎末用求指点
import sensor, image ,time
from pyb import UART
uart = UART(3, 9600)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA) # can be QVGA on M7...
sensor.skip_frames(30)
sensor.set_auto_gain(False) # must turn this off to prevent image washout...
while(True):
img = sensor.snapshot()
img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens.
for code in img.find_qrcodes():
print(code)
if(code==1):
uart.write("1")
if(code==2):
uart.write("2")
扫码选择这个if该怎末用求指点
import sensor, image ,time
from pyb import UART
uart = UART(3, 9600)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA) # can be QVGA on M7...
sensor.skip_frames(30)
sensor.set_auto_gain(False) # must turn this off to prevent image washout...
while(True):
img = sensor.snapshot()
img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens.
for code in img.find_qrcodes():
print(code)
if(code.payload()=='1'):
uart.write("1")
if(code.payload()=='2'):
uart.write("2")
使用get_pixel遍历一遍图像的像素点非常慢,有改进方法吗
# Untitled - By: 33316 - Tue May 7 2024
import sensor, image, time
from machine import UART #openart专用machine
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
hei = (1, 38, 12, -36, -128, 12)
while(True):
clock.tick()
img = sensor.snapshot()
img_ezh_hei = img
img_ezh_hei.binary([hei])
for x in range(0,320):
for y in range(240,0,-1):
if(img_ezh_hei.get_pixel(x,y)==(0,0,0)):
a=1
print(x)
用到一个定时器,一个pwm,出现报错
用到一个定时器,一个pwm,出现报错ValueError: Pin(D12) doesn't have an af for Timer(2)
import sensor, image, time
from pyb import Pin, Timer,LED
sensor.reset() # Reset and initialize the sensor.
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) # Wait for settings take effect.
RUN = LED(4)
STATUE = LED(1)
tim = Timer(4, prescaler=83,period=370)
#驱动蜂鸣器
def BeepOn():
tim.channel(1, Timer.PWM, pin=Pin("P7"), pulse_width=187)
#关闭蜂鸣器
def BeepOff():
tim.channel(1,Timer.PWM, pin=Pin("P7"), pulse_width=0)
def tick(timer): # we will receive the timer object when being called
RUN.toggle()
tim = Timer(2, freq=1) # create a timer object using timer 4 - trigger at 1Hz
tim.callback(tick) # set the callback to our tick function
BeepOn()
while(True):
img = sensor.snapshot() # Take a picture and return the image.
# to the IDE. The FPS should increase once disconnected.