.........................
gtq4 发布的帖子
-
向串口发送列表
import sensor, image, time
from pyb import UART
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.
clock = time.clock()
uart=UART(3,9600)# Create a clock object to track the FPS.
uart.init(9600,bits=8,parity=None,stop=1)
list=[1,1,2]
while(True):clock.tick() uart.write(list)
我现在这样写他会出现 需要具有缓冲协议的对象,该怎么改。
-
openmv颜色例程问题
# 多颜色组合识别 。 import sensor, image, time 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() while(True): clock.tick() img = sensor.snapshot() for blob in img.find_blobs(thresholds, pixels_threshold=100, area_threshold=100, merge=True): if blob.code() == 3: # r/g code img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) img.draw_string(blob.x() + 2, blob.y() + 2, "r/g") if blob.code() == 5: # r/b code img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) img.draw_string(blob.x() + 2, blob.y() + 2, "r/b") if blob.code() == 6: # g/b code img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) img.draw_string(blob.x() + 2, blob.y() + 2, "g/b") if blob.code() == 7: # r/g/b code img.draw_rectangle(blob.rect()) img.draw_cross(blob.cx(), blob.cy()) img.draw_string(blob.x() + 2, blob.y() + 2, "r/g/b") print(clock.fps())
blob.code=? 这个数字是因为红色色块是1,绿色是2,蓝色是4吗,怎么得来的。如果我只想判断是否是红色色块是不是就是 blob.code=1,绿色就是 blob.code=2
-
三个代号1,2,3的色块,并排放在一起,摄像头从左到右一次检测,代码逻辑怎么写知道三个色块放置的顺序。
求程序的逻辑和思路,如色块顺序是321,识别后将321打包发送给串口
-
RE: openmv颜色识别能识别离摄像头最近的色块吗,如果能用到那些代码。
那我通过摄像头识别三个大小一样的色块,知道他们的位置后,将他们所处的位置发给单片机也不能实现吗
-
RE: 脱机运行时,代码怎么改才能在识别二维码时候只拍一次二维码,二维码内容就一直出现在LCD上,而不用一直对准二维码识别
那是不是 a="code.payload"
while True:
for code in img.find_qrcodes()
a=code.payload()
img.draw()
lcd.display(img) -
RE: 脱机运行时,代码怎么改才能在识别二维码时候只拍一次二维码,二维码内容就一直出现在LCD上,而不用一直对准二维码识别
请问下第一行要显示的字符串=“”怎么用代码表示
-
脱机运行时,代码怎么改才能在识别二维码时候只拍一次二维码,二维码内容就一直出现在LCD上,而不用一直对准二维码识别
import sensor, image, time, lcd, pyb sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... clock = time.clock() lcd.init() # Initialize the lcd screen. while(True): clock.tick() img = sensor.snapshot() for i in range(10): x = (pyb.rng() % (2*img.width())) - (img.width()//2) y = (pyb.rng() % (2*img.height())) - (img.height()//2) r = (pyb.rng() % 127) + 128 g = (pyb.rng() % 127) + 128 b = (pyb.rng() % 127) + 128 img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens. for code in img.find_qrcodes(): img.draw_rectangle(code.rect(), color = (255, 0, 0)) print(code) img.draw_string(x, y, code.payload(), color = (255, 0, 0), scale = 5, mono_space = False) lcd.display(img) print(clock.fps())
-
识别一个内容为123的二维码,想让其二维码内容出现在LCD屏幕上。出现错误:没有足够的位置参数,
# QRCode Example # # This example shows the power of the OpenMV Cam to detect QR Codes # using lens correction (see the qrcodes_with_lens_corr.py script for higher performance). import sensor, image, time, lcd, pyb sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... clock = time.clock() lcd.init() # Initialize the lcd screen. while(True): clock.tick() img = sensor.snapshot() for i in range(10): x = (pyb.rng() % (2*img.width())) - (img.width()//2) y = (pyb.rng() % (2*img.height())) - (img.height()//2) r = (pyb.rng() % 127) + 128 g = (pyb.rng() % 127) + 128 b = (pyb.rng() % 127) + 128 img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens. for code in img.find_qrcodes(): img.draw_rectangle(code.rect(), color = (255, 0, 0)) print(code) img.draw_string(img.draw_string(x, y, code.payload(), color = (r, g, b), scale = 2, mono_space = False) ) lcd.display(img) print(clock.fps())
-
运行后一扫到二维码就出现错误 oseeor: Not enough positional arguments!
# QRCode Example # # This example shows the power of the OpenMV Cam to detect QR Codes # using lens correction (see the qrcodes_with_lens_corr.py script for higher performance). import sensor, image, time,lcd sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... clock = time.clock() lcd.init() # Initialize the lcd screen. while(True): clock.tick() 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(): img.draw_rectangle(code.rect(), color = (255, 0, 0)) print(code) img.draw_string(code.payload()) lcd.display(img) print(clock.fps())