michaela
Posts: 9
Joined: Sat Nov 19, 2016 2:03 pm

Pi Camera 3-4x darker than webcam -- any suggestions?

Sun Nov 20, 2016 1:21 am

Running the Raspberry Pi camera module right next to my laptop camera module facing the same direction with nearly the same lighting, the raspberry pi image is 3-4x darker on average. (see photo below)

I'm trying to have them detect the position of a green stuffed animal using OpenCV and the same HSV values:
greenLower = (57, 97, 72)
greenUpper = (72, 255, 132)

Works perfectly on the webcam, but trying to figure out why the Raspberry Pi wasn't detecting anything (it's headless), I created a script to output the frame's average brightness to console and saw the huge difference.

(if photo is too small, average brightness from Pi Camera varies 13.6 to 20.4, webcam varies 72.0 to 76.4)
(it appears the forums are scaling the image down significantly, raw image available at http://michaelanuzis.com/imgs/PiCamVsWebCam.png)
Image

I read that attempting to capture 32fps might be too fast, so reduced the Pi to only attempt 10fps. I also read that it takes the camera a few seconds to warm up and calibrate an image so I waited about 10 seconds before snapping the above photo.

Code: Select all

# PiCamera code excerpt
camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 10
rawCapture = PiRGBArray(camera, size=(640, 480))

# allow the camera to warmup
time.sleep(0.1)

for frame_data in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
    frame = frame_data.array
    frame_mean = frame.mean()
    print 'no target detected (frame avg: %f)' % frame_mean # (simplified for forums)
    rawCapture.truncate(0)
Appreciate any suggestions.

Return to “Camera board”