Here is my code. You can see in the images that the QR Code is overexposed and the histogram shows it. Using manual exposure settings is only good if the environment is tightly controlled. I need a better autoexposure.
Code: Select all
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.set_windowing((240, 240)) # look at center 240x240 pixels of the VGA resolution.
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout...
sensor.set_auto_whitebal(False)
sensor.set_auto_exposure(True)
#sensor.set_brightness(0) # range 0-31
#sensor.set_saturation(0) # range -3 to 3
#sensor.set_gainceiling(2) # 2,4,8,16,32,64,128
#sensor.set_contrast(2) # range -3 to 3
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
for code in img.find_qrcodes():
img.draw_rectangle(code.rect(), color = 127)
print(code)