I've been using the raspi cam for some time now. I was using it inside a machine, to take photos from what's going on there. As far as I can tell, the cables are all attached as they should be - but all of a sudden, the images look like this.
Can anybody help? What's going on here?
In the preview window, the photo looks normal. After a restart, the output is completely black instead.
This is my test code which makes the same output as the production code. First, I measure the lighting and fix the camera setting. Then I take a series of photos while the machine works.
I take the photo in the original cam's format (rgb), crop it with numpy slicing and save it afterwards. That had been the fastest image taking process I was able to come up with.
Around 12 000 photos later, the camera does this. Why? What can I do about it?
from time import sleep from picamera import PiCamera import numpy as np from PIL import Image CROPBOX = (317, 464, 317+370, 464+251) #x0,y0,x1,y1 RESOLUTION = (1024, 768) cam = PiCamera(camera_num=0, resolution=RESOLUTION, framerate=40, sensor_mode=0, clock_mode='reset', framerate_range=None) cam.meter_mode = 'average' #cam.zoom = 0.3, 0.3, 0.65, 0.65 cam.iso = 50 sleep(0.5) cam.shutter_speed = cam.exposure_speed cam.exposure_mode = 'off' sleep(0.5) # fix white bracket gains = cam.awb_gains cam.awb_mode = 'off' cam.awb_gains = gains x0, y0, x1, y1 = CROPBOX output = np.empty((RESOLUTION, RESOLUTION, 3), dtype=np.uint8) cam.capture(output, "rgb") Image.fromarray(output[y0:y1,x0:x1,:]).save("test_image.png") cam.close()