PyImageSearch / imutils

A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to adjust Brightness , contrast using VideoStream

Ajinkz opened this issue · comments

Just like this, we get the value of brightness and other parameters when using cv2. VideoCapture(0)

cap.get(cv2.CAP_PROP_BRIGHTNESS)
cap.get(cv2.CAP_PROP_CONTRAST )
cap.get(cv2.CAP_PROP_SATURATION)
cap.get(cv2.CAP_PROP_GAIN)

How to get these values when using VideoStream?

With the current implementation you cannot. I would suggest you subclass VideoStream and allow those methods to be set via the constructor. Another option would be to create the cv2.VideoCapture object, manually set any parameters, and then pass the cap object into VideoStream so you can enjoy the benefit of threaded frame access.

Adrian, can you please show an example of how this would be done?
I tried:
camera = PiCamera()
rawCapture = PiRGBArray(camera)
camera.capture(rawCapture, format="bgr")

vs = VideoStream(src=camera).start()
I also tried:
vs = VideoStream(src=rawCapture).start()
neither of these work, Argument 'index' is required to be an int.
I'm lost...