连接openmv时,出现OSError: Reset Failed,怎么回事?
看上去是sensor初始化失败,检查一下摄像头模块安装的对不对。如果不行,联系售后寄回维修。
如何调节相机的曝光时间至一个设定的数值?
import sensor
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_auto_exposure(False, exposure_us=10000)
sensor.skip_frames(time=2000)
print(sensor.get_exposure_us())
这个代码我在OpenMV4 Plus OV5640上运行,结果显示9952。符合预期。
openMV 关于find_displacement的问题,不可迭代是怎么回事?
import sensor, image, time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.B64X64) # or B40x30 or B64x64
clock = time.clock() # Tracks FPS.
old = sensor.snapshot()
#先获取一张图片
while(True):
clock.tick() # Track elapsed milliseconds between snapshots().
img = sensor.snapshot() # Take a picture and return the image.
[delta_x, delta_y, response] = old.find_displacement(img)
#delta_x delta_y分别表示 x y 方向上,这一帧图像相比上帧图像移动的像素数目。
old = img.copy()
print("%0.1f X\t%0.1f Y\t%0.2f QoR\t%0.2f FPS" % \
(delta_x, delta_y, response, clock.fps()))
AttributeError:'Inage' object has no attribute 'find_number'
# LetNet Example
import sensor, image, time
sensor.reset() # Reset and initialize the sensor.
sensor.set_contrast(3)
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.set_windowing((28, 28))
sensor.skip_frames(time = 2000) # Wait for settings take effect.
sensor.set_auto_gain(False)
sensor.set_auto_exposure(False)
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.
out = img.invert().find_number()
if out[1] > 3.0:
print(out[0])
#print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
串口发送有问题
Hello World Example
Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
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.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
在使用中值滤波算法时,滤波后的每个像素点RGB值为什么和滤波前一样呢?求解答
import sensor, image, time
sensor.reset() # 初始化sensor
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot() # 拍一张照片,返回图像
img1 = img.mean(2)#均值滤波后的图像
for i in range(0,img.width()):
for j in range(0,img.height()):
tuple1 = img.get_pixel(i,j)
tuple2 = img1.get_pixel(i,j)
tuple3 = (tuple1[0]-tuple2[0],tuple1[1]-tuple2[1],tuple1[2]-tuple2[2])
print(tuple1)
print(tuple2)
print(tuple3)
print(clock.fps())
ValueError: Pixel format is not supported!
@x1oq # Hello World Example
Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
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.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
ValueError: Pixel format is not supported!
Hello World Example
Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
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.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
openMV运行示例hello world程序点击左下角连接后指示灯熄灭无法获取图像
# Hello World Example
#
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
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.
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
# to the IDE. The FPS should increase once disconnected.
SyntaxError: can't assign to expression出错误报出如何解决,求大神帮忙
import sensor, image, time, math
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.VGA) # 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):
#img = sensor.snapshot() # Take a picture and return the image.
img = sensor.snapshot()
#红色阈值
for y in range(0,480,3):
for x in range(0,640):
#img.get_pixel(x,y)
if img.get_pixel(x,y)>=205:
img.get_pixel(x,y)=255
elif img.get_pixel(x,y)<=195:
img.get_pixel(x,y)=0
else:
img.get_pixel(x,y)=img.get_pixel(x,y)