In your example webcam.py the Setting appear to be imported into webcam.py from help.py. Then after camera_init() you modify some of them.
Do the Setting imported before camera_init() have any effect? I tried to modify help.py, ie 'speffect' but that change does not seem to come through to webcam.py.
Should not the camera settings be done after camera_init(), as below?.
import camera
from machine import Pin
import utime
flash_light = Pin(04,Pin.OUT)
camera.init()
# camera settings
camera.pixformat(0) # 0:JPEG, 1:Grayscale (2bytes/pixel), 2:RGB565
camera.framesize(10) # 1:96x96, 2:160x120, 3:176x144, 4:240x176, 5:240x240
# 6:320x240, 7:400x296, 8:480x320, 9:640x480, 10:800x600
# 11:1024x768, 12:1280x720, 13:1280x1024, 14:1600x1200
# 15:1920x1080, 16:720x1280, 17:864x1536, 18:2048x1536
camera.quality(30) # [0,63] lower number means higher quality
camera.contrast(0) # [-2,2] higher number higher contrast
camera.saturation(0) # [-2,2] higher number higher saturation. -2 grayscale
camera.brightness(0) # [-2,2] higher number higher brightness. 2 brightest
camera.speffect(2) # 0:,no effect 1:negative, 2:black and white, 3:reddish,
# 4:greenish, 5:blue, 6:retro
camera.whitebalance(0) # 0:default, 1:sunny, 2:cloudy, 3:office, 4:home
camera.aelevels(0) # [-2,2] AE Level: Automatic exposure
camera.aecvalue(0) # [0,1200] AEC Value: Automatic exposure control
camera.agcgain(0) # [0,30] AGC Gain: Automatic Gain Control
flash_light.on()
utime.sleep(0.1) # seems to take awhile for the flash to fire-up
img = camera.capture()
flash_light.off()
print (len(img))
# save image
with open('image.jpeg', 'w') as outfile:
outfile.write(img)
Sometimes I get a "buffer protocol required" error.
Appreciate your comments and thanks for producing this comprehensive project.
Dave
In your example webcam.py the Setting appear to be imported into webcam.py from help.py. Then after camera_init() you modify some of them.
Do the Setting imported before camera_init() have any effect? I tried to modify help.py, ie 'speffect' but that change does not seem to come through to webcam.py.
Should not the camera settings be done after camera_init(), as below?.
Sometimes I get a "buffer protocol required" error.
Appreciate your comments and thanks for producing this comprehensive project. Dave