0

I wrote a python script to interface with the camera module (I have camera version 2.1). At first I tried with picamera, which has worked in the past. According to pip I have version 1.13 installed.

import picamera
camera = picamera.PiCamera()
camera.sharpness = 100
camera.brightness = 50
camera.capture("/tmp/test.jpg")

But the image that comes out of this is blank. If I set the brightness to 100, it is a totally white image. If I set it to 50 or less, it is a black image. Everything in between is a shade of gray.

I thought the camera itself might be an issue, but when I use raspistill on the command line, the image comes out just fine.

Why does raspistill work, when picamera gives an empty image? Could it be that picamera needs some sort of delay and if so, how is that done?

1

From the basic recipes in the picamera docs they give this example with "warm-up time"!

from time import sleep
from picamera import PiCamera

camera = PiCamera()
camera.resolution = (1024, 768)
camera.start_preview()
# Camera warm-up time
sleep(2)
camera.capture('foo.jpg')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.