使用OpenMV拍摄视频报错Unexpected image geometry,怎么解决?
-
-
import sensor, image, time, math, struct, mjpeg import json from pyb import LED,Timer from struct import pack, unpack import Message,JY901 green_led = LED(2) m = mjpeg.Mjpeg("example.mjpeg") #初始化镜头 sensor.reset() sensor.set_pixformat(sensor.RGB565)#设置相机模块的像素模式 sensor.set_framesize(sensor.QQVGA)#设置相机分辨率160*120 sensor.skip_frames(time=3000)#时钟 sensor.set_auto_whitebal(False)#若想追踪颜色则关闭白平衡 clock = time.clock()#初始化时钟 #主循环 while(True): clock.tick()#时钟初始化 #接收串口数据 JY901.data_result() #读取JY901数据 if Message.Ctr.WorkMode == 2 or Message.Ctr.WorkMode == 3: #当标志为开始摄像 m.add_frame(sensor.snapshot()) green_led.toggle() elif Message.Ctr.WorkMode == 1: #当标志为停止摄像 m.close(clock.fps())
-
m.add_frame(sensor.snapshot())
改为
m.add_frame(sensor.snapshot().compress())