
# Untitled - By: DianlongYang - 周二 9月 8 2020
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster (160x120 max on OpenMV-M7)
sensor.set_framesize(sensor.QQVGA) # 320 * 240
sensor.set_auto_gain(False,gain_db=20) #设置增益值(自动增益模式下的典型值为9)
sensor.set_auto_whitebal(False) #如果开启自动白平衡,设备会自动调整(不同颜色通道的)增益
sensor.set_auto_exposure(False, exposure_us=37966) #设置曝光时长(自动模式下的典型值是5845us)
sensor.skip_frames(time = 2000)
ROI_X = 87 #56 59
ROI_Y= 25 #2 10
ROI_W = 38 #40 38
ROI_H= 70 #75 70
ROI = (ROI_X,ROI_Y,ROI_W ,ROI_H)
while(True):
init12 = time.ticks()
img = sensor.snapshot()
img.draw_rectangle(ROI,color = (0, 0, 0), thickness = 1, fill = False)
# 5分条
img.draw_line((ROI_X+9, 82, ROI_X+9 + 20, 82), color = (255, 0, 0),thickness=1)
img.draw_line((ROI_X+9, 50, ROI_X+9 + 20, 50), color = (255, 0, 0),thickness=1)
init32 = time.ticks()
print(init32 - init12)估计是硬件坏了,联系卖家维修。