Ask Your Question

Revision history [back]

I'm also struggling with a similar problem.So far i figured out to put a piece of colored paper in front of the camera, get the color of the pixel and use it as a reference for brightness/color calibration.This is my code:

from SimpleCV import *
cam = Camera()
bright = 1
while True:
    img = cam.getImage() #grab a frame
    img = img*bright                # multiply the image by the brightness variable

    pixel=img[0,0]                  # reference color
    if r < 128 :                    # change the brightness var until its 128
        bright=bright + 0.1         # 0.1 - the speed of change/cycle
    elif r > 128 :
        bright=bright - 0.1    

In your case i guess that img.binarize could also work. Hope this helps.I'm new to simplecv and python so sorry if this isn't an elegant solution.