openmv舵机转到度数
舵机需要额外供电。
OpenMV 的VIN引脚供电。
或者OpenMV 传感器扩展板的DC接口插入电池。
来自星瞳实验室APP: OpenMV传感器扩展板 https://singtown.com/product/49896/openmv-sensor-shield/
舵机只能执行第一条语句,后面的语句无法执行
Untitled - By: xiaoji - 周六 2月 26 2022
#import sensor, image, time
from pyb import Servo
import time
s1 = Servo(1) # servo on position 1 (P7)
while(1):
s1.angle(45) # move to 45 degrees
time.sleep(600)
s1.angle(90)
time.sleep(600)
RuntimeError:Frame size is not supported or is not set 错误
openmv4H7 set_windowing后报错
import sensor, image, time
from pyb import USB_VCP
usb = USB_VCP()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(time = 2000)
sensor.set_windowing((134,243,113,110))
clock = time.clock()
img = sensor.snapshot()
while(True):
clock.tick()
img = sensor.snapshot()
请问这是什么问题
mlx90640调色问题 调色不一致
import image, time, fir
drawing_hint = image.BICUBIC # or image.BILINEAR or 0 (nearest neighbor)
# Initialize the thermal sensor
fir.init()
w = fir.width()
h = fir.height()
if (fir.type() == fir.FIR_MLX90621):
w = w * 10
h = h * 10
elif (fir.type() == fir.FIR_MLX90640):
w = w * 10
h = h * 10
elif (fir.type() == fir.FIR_MLX90641):
w = w * 10
h = h * 10
elif (fir.type() == fir.FIR_AMG8833):
w = w * 20
h = h * 20
# FPS clock
clock = time.clock()
while (True):
clock.tick()
try:
img = fir.snapshot(x_size=w, y_size=h,
color_palette=fir.PALETTE_IRONBOW, hint=drawing_hint,
copy_to_fb=True)
except OSError:
continue
# Print FPS.
print(clock.fps())
为什么例程里这张图mlx90640调色是这样的
而我仿照编写的程序 为了放在摄像头图像上
import image, time, fir, sensor
drawing_hint = image.BILINEAR # or image.BILINEAR or 0 (nearest neighbor) or image.BICUBIC
# Initialize the thermal sensor
sensor.reset()
#初始化摄像头,reset()是sensor模块里面的函数
sensor.set_pixformat(sensor.RGB565)
#设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种
sensor.set_framesize(sensor.QVGA)
#设置图像像素大小
sensor.skip_frames(time = 2000)
fir.init(type=fir.FIR_MLX90640, refresh=32)
w = fir.width()*10
h = fir.height()*10
ir_buffer = fir.snapshot(x_size=w, y_size=h, pixformat=sensor.GRAYSCALE)
clock = time.clock()
while (True):
clock.tick()
img = sensor.snapshot()
ta, ir, to_min, to_max = fir.read_ir()
to_max=to_max/0.92
fir.draw_ir(ir_buffer, ir, alpha=256, hint=drawing_hint)
img.draw_image(ir_buffer, 0, 0, alpha=256,color_palette=fir.PALETTE_IRONBOW)
出来的图像调色是这样的
怎么才能变成上面那幅图的调色
Ncc模板匹配按照视频教程 识别不出来箭头 阈值调高过也不行 pmg照片传不上去就不传了
# Template Matching Example - Normalized Cross Correlation (NCC)
#
# This example shows off how to use the NCC feature of your OpenMV Cam to match
# image patches to parts of an image... expect for extremely controlled enviorments
# NCC is not all to useful.
#
# WARNING: NCC supports needs to be reworked! As of right now this feature needs
# a lot of work to be made into somethin useful. This script will reamin to show
# that the functionality exists, but, in its current state is inadequate.
import time, sensor, image
from image import SEARCH_EX, SEARCH_DS
# Reset sensor
sensor.reset()
## Set sensor settings
#sensor.set_contrast(1)
#sensor.set_gainceiling(16)
## Max resolution for template matching with SEARCH_EX is QQVGA
#sensor.set_framesize(sensor.QQVGA)
## You can set windowing to reduce the search image.
##sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
#sensor.set_pixformat(sensor.GRAYSCALE)
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
# Load template.
# Template should be a small (eg. 32x32 pixels) grayscale image.
template = image.Image("/666.pgm")
clock = time.clock()
# Run template matching
while (True):
clock.tick()
img = sensor.snapshot()
# find_template(template, threshold, [roi, step, search])
# ROI: The region of interest tuple (x, y, w, h).
# Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
# Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
#
# Note1: ROI has to be smaller than the image and bigger than the template.
# Note2: In diamond search, step and ROI are both ignored.
r = img.find_template(template, 10, step=4, search=SEARCH_EX)
if r:
img.draw_rectangle(r)
print(clock.fps())
Openmv可以用3.3V供电吗?会不会因此导致openmv烧坏?
不能用3.3v供电。
最好供电方法:
VIN引脚供电3.7v-5v。
或者直接USB供电
如果没有电路知识,OpenMV插上传感器扩展板,DC接口插上5v电源。
https://singtown.com/product/49896/openmv-sensor-shield/
openmv摄像头识别二维码为什么我只有0.006帧的帧率,求大佬?
import sensor, image, time, math
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...
clock = time.clock()
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():
message=code.payload()
print(message)
print("FPS %f" % clock.fps())
请问怎么在帧缓冲区显示想要看的图像
这是第二个代码,刚刚忘了贴
# Hello World Example
#
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time, pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)#160X120
sensor.skip_frames(time=100)
clock=time.clock()
while(True):
s=sensor.snapshot()
a=s.copy(copy_to_fb=True)
a.to_grayscale()
先颜色识别后模块匹配的程序,为什么没有图像显示?
或者,
sensor.set_pixformat(sensor.RGB565) #设置像素模式为彩色
sensor.skip_frames(time = 2000)
img = sensor.snapshot() #截取当前图像,存放于变量img
每次设置后加一句
sensor.skip_frames(time = 2000)
使图像跳过几帧,目的是使sensor的设置生效。
画框问题,改变线条颜色时,在软件上显示的仅一条边的颜色有变化,是什么问题呢?
Untitled - By: Administrator - 周三 四月 11 2018
import sensor, image, time
sensor.reset()#初始化
sensor.set_pixformat(sensor.RGB565)#像素模式
sensor.set_framesize(sensor.QVGA)#图像大小
sensor.skip_frames(time=2000)
ROI=(23,79,244,47)
while(True):
img=sensor.snapshot()
statistics=img.get_statistics(roi=ROI)
color_l=statistics.l_mode()
color_a=statistics.a_mode()
color_b=statistics.b_mode()
print(color_l,color_a,color_b)
img.draw_rectangle(ROI,color=(255,0,0))
img.save("/n")