Long exposures

Hi,
I have two questions:

  1. I want to take long exposure (say, up to 300 seconds) images.
    How do I setup the camera for this?
    I see sensor.set_exposure_cntrl() in the documentation. Is this what I use, how do I use it?

  2. I’ve tried to get the camera type by executing
    import sensor
    print("%s" % (sensor.get_id()))
    The output is 119, not something like sensor:OV7725 as expected. What am I doing wrong?

Thanks for your consideration,
Ron

You can do time lapse photos by using the blend command. So, basically you take pictures and then blend them together.

See the advanced frame differencing script for how to do this… (Note, this reminds me that I should add an example for this). In the advanced frame differencing script I blend images into a background image.

Wait, here’s the code:

sensor.snapshot().save("temp/bg.bmp")
while(True):
    img = sensor.snapshot() # Take a picture and return the image.
    img.blend("temp/bg.bmp", alpha=200)
    img.save("temp/bg.bmp")

And just do that repeatedly. Note that I just guessed the alpha value up there. You need to figure out what alpha value you’d like.

For the second question the sensor ID value is an enum. So, you have to compare the value output with the enum type. The value of the return doesn’t make sense directly on it’s own. It’s just a number.

The enum values are defined in Python too:

if (sensor.get_id() == sensor.OV2640): # (or OV7725)
    .....

Thanks for the quick replies :slight_smile: