picamera: capturing black image

Viewed 55

I'm trying to capture images with my RaspiCam v2. I have a very specific setup and specified all camera parameters that i need to get a good image quality. I figured them out using a separate python script caputring the image with following line: camera.capture('filename.jpg').

In my actual program i want to capture the image not directly to a file but as a BytesIO() stream. Even though i keep all my parameters same, i only got black images.

This is my code:

if self.camera is not None:
            buffer = BytesIO()
            self.camera.shutter_speed = shutter_speed_ms
            self.camera.iso = iso
            self.camera.resolution = resolution
            self.camera.brightness = brightness
            self.camera.contrast = contrast
            self.camera.sharpness = sharpness
            self.camera.saturation = saturation
            self.camera.awb_mode = awb_mode

            self.camera.capture(buffer, "jpeg")
            buffer.seek(0)
        else:
            raise RuntimeError("capture instance does not exist.")

is there a difference between the camera parameters when capturing to a file or capturing to a stream?

0 Answers
Related