Skip to content

Instantly share code, notes, and snippets.

@1kane
Last active February 14, 2017 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1kane/0d2334f623cecf35b4f77b6525fe92ff to your computer and use it in GitHub Desktop.
Save 1kane/0d2334f623cecf35b4f77b6525fe92ff to your computer and use it in GitHub Desktop.
from picamera import PiCamera, mmal, mmalobj as mo
from time import sleep
#camera = mo.MMALCamera()
camera = PiCamera(resolution=(2592, 1944))
camera.start_preview()
preview = mo.MMALRenderer()
encoder = mo.MMALVideoEncoder()
camera.preview.close() # .disconnect()
camera._camera.outputs[0].framerate = 0 #not limiting the framerate with value 0
ex = camera._camera.control.params[mmal.MMAL_PARAMETER_EXPOSURE_MODE]# switch to exp_mode night
ex.value = mmal.MMAL_PARAM_EXPOSUREMODE_NIGHT
camera._camera.control.params[mmal.MMAL_PARAMETER_EXPOSURE_MODE] = ex
#connect my preview
preview.connect(camera._camera.outputs[0])
sleep(10) #now its adjusting
# but when we take pictures here, our preview gets destroyed :(
self.camera.capture("test.jpg", format='jpeg') # no matter if use_video_port=True or not
print ('exposure: %d ms gain: %d') % (camera.exposure_speed, camera.analog_gain)# thats what i wanna find out at beginning
sleep(10)
#now preview is gone because we set it up manualy and didnt use the 'wrapper' class i guess
# just tested again and now it seems to work....more testing needed here
preview.disconnect()
preview.close()
camera.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment