- improved
git-svn-id: http://moon:8086/svn/software/trunk/projects/opencv@323 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+21
-12
@@ -14,8 +14,24 @@ class PiVideoStream:
|
||||
self.camera.exposure_mode = 'auto'
|
||||
# self.camera.image_effect = 'colorbalance'
|
||||
# self.camera.image_effect_params = (0,1,1,1,0,0)
|
||||
self.camera.exposure_mode = 'auto'
|
||||
self.camera.awb_mode = 'off'
|
||||
self.camera.awb_gains = (1.5, 1.5)
|
||||
# self.camera.analog_gain = 1.75
|
||||
# self.camera.digital_gain = 1.00
|
||||
self.rawCapture = PiRGBArray(self.camera, size=resolution)
|
||||
self.stream = self.camera.capture_continuous(self.rawCapture,
|
||||
format="bgr", use_video_port=True)
|
||||
|
||||
# initialize the frame and the variable used to indicate
|
||||
# if the thread should be stopped
|
||||
self.frame = None
|
||||
self.stopped = False
|
||||
self.fps = None
|
||||
self.thread = None
|
||||
self.startup = True
|
||||
|
||||
def printSettings(self):
|
||||
awb_gains = self.camera.awb_gains
|
||||
print ("sensor_mode : " + str(self.camera.sensor_mode))
|
||||
print ("resolution : " + str(self.camera.resolution))
|
||||
@@ -38,18 +54,6 @@ class PiVideoStream:
|
||||
print ("image_effect_params : " + str(self.camera.image_effect_params))
|
||||
print ("sharpness : " + str(self.camera.sharpness))
|
||||
|
||||
self.rawCapture = PiRGBArray(self.camera, size=resolution)
|
||||
self.stream = self.camera.capture_continuous(self.rawCapture,
|
||||
format="bgr", use_video_port=True)
|
||||
|
||||
# initialize the frame and the variable used to indicate
|
||||
# if the thread should be stopped
|
||||
self.frame = None
|
||||
self.stopped = False
|
||||
self.fps = None
|
||||
self.thread = None
|
||||
self.startup = True
|
||||
|
||||
def start(self):
|
||||
# start the thread to read frames from the video stream
|
||||
self.thread = Thread(target=self.update, args=())
|
||||
@@ -59,6 +63,11 @@ class PiVideoStream:
|
||||
def update(self):
|
||||
# keep looping infinitely until the thread is stopped
|
||||
for f in self.stream:
|
||||
if self.camera.exposure_mode == 'auto':
|
||||
if self.camera.analog_gain > 1.75 and self.camera.digital_gain == 1.0:
|
||||
self.camera.exposure_mode = 'off'
|
||||
self.printSettings()
|
||||
|
||||
if self.startup:
|
||||
self.fps = FPS().start()
|
||||
self.startup = False
|
||||
|
||||
Reference in New Issue
Block a user