怎么用代码控制openmv图像自动调亮
-
@kidswong999 不是,问题我都发在上边了,我都怀疑你有没有好好看一下,这跟摄像头模组固件版本有关系吗?这还一天一回复,这个效率等我把这个弄好了恐怕一个星期起步了吧,真是着急
-
@kidswong999 东西刚送走,现在我手头暂时也没openmv了,具体代码跟后面也没关系,前面的sensor设置就是rgb color tracking那个,我把skip frame删了,然后因为是摄像头是倒着放的,加了个水平垂直翻转,其他的都一样
-
@kidswong999 就是正常的openmv4h7cam
ov7725
-
就这么个代码,拿手遮一下镜头图像就亮了
# Single Color RGB565 Blob Tracking Example # # This example shows off single color RGB565 tracking using the OpenMV Cam. import sensor, image, time, math threshold_index = 0 # 0 for red, 1 for green, 2 for blue # Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max) # The below thresholds track in general red/green/blue things. You may wish to tune them... thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds (30, 100, -64, -8, -32, 32), # generic_green_thresholds (0, 30, 0, 64, -128, 0)] # generic_blue_thresholds sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock() # Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are # returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the # camera resolution. "merge=True" merges all overlapping blobs in the image. while(True): clock.tick() img = sensor.snapshot() print(clock.fps())
-
你的代码就是开机2000ms自动调亮度和白平衡,然后关闭白平衡。
所以你的亮度是根据开机2000ms来校准的。
-
使用set_auto_exposure可以控制曝光时间,就是调亮度。
-
@kidswong999 但是他后边怎么还会变呢
-
你没有把自动曝光关掉。
解决办法:在21行加入
sensor.set_auto_exposure(False)
-
它开机校准之后后面亮度应该是不变的啊,但是我这里在校准之后再拍到比较暗的区域的时候,图像还是会突然变亮的啊
-
@kidswong999 好的我试一下
-
@kidswong999 确实如此,感激不尽