RuntimeError: Sensor control failed
openmv里在运行时出现RuntimeError: Sensor control failed的错误弹窗,应该如何解决?
找不到 ml 文件怎么解决
import sensor, image, time, os, ml, math, uos, gc
怎么能减小灰度图与彩图之间的切换频率?
import sensor, image, time
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() # Create a clock object to track the FPS.
while(True):
clock.tick() # Update the FPS clock.
img = sensor.snapshot()
# img这里是彩色
img = img.to_grayscale()
# img这里是灰色
print(clock.fps())
运行二维码识别程序 报错
import sensor, image
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA) # can be QVGA on M7...
sensor.skip_frames(30) # 修改sensor配置之后, 跳过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)
报错信息为
this function is unavailable on your OpenMV Cam
运行lcd_1.py后,lcd还是白屏,是什么原因?
LCD Example
Note: To run this example you will need a LCD Shield for your OpenMV Cam.
The LCD Shield allows you to view your OpenMV Cam's frame buffer on the go.
import sensor, image, lcd
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA2) # Special 128x160 framesize for LCD Shield.
lcd.init() # Initialize the lcd screen.
while(True):
lcd.display(sensor.snapshot()) # Take a picture and display the image.
如何获取一个像素点的LAB值
import sensor, image, time
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() # Create a clock object to track the FPS.
while(True):
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image.
pixel_rgb = img.get_pixel(0,0)
print(pixel_rgb)
pixel_lab = image.rgb_to_lab(pixel_rgb)
print(pixel_lab)
04-ulab ulab数学操作返回错误'module' object has no attribute 'array'
更改为:
import sensor, image, time
from ulab import numpy as np
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)
clock = time.clock() # Create a clock object to track the FPS.
while (True):
img = sensor.snapshot() # Take a picture and return the image.
a = np.array(img, dtype=np.uint8)
print("mean: %d std:%d"%(np.mean(a), np.std(a)))
官方例程报错 no module named 'display'
import sensor
import display
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA2) # Special 128x160 framesize for LCD Shield.
lcd = display.SPIDisplay() # Initialize the lcd screen.
while True:
lcd.write(sensor.snapshot()) # Take a picture and display the image.
貌似删了注册表的东西,重装ide也一样报错。