@@ -135,7 +135,9 @@ def HW_trigger(self, channel):
135135 output .array [
136136 self .roi .top : self .roi .top + self .roi .height ,
137137 self .roi .left : self .roi .left + self .roi .width ,
138- 0 ,])
138+ 0 ,
139+ ]
140+ )
139141
140142 def _fetch_data (self ):
141143 if self ._queue .qsize () is not 0 :
@@ -164,10 +166,15 @@ def initialize(self):
164166 self .setLED (False )
165167 self .set_awb_mode (0 ) # set auto white balance to off
166168 self ._get_sensor_shape ()
167- #default to full image at init.
168- self ._set_roi (ROI (0 , 0 , self .camera .resolution .width ,
169- self .camera .resolution .height ))
170-
169+ # default to full image at init.
170+ self ._set_roi (
171+ ROI (
172+ 0 ,
173+ 0 ,
174+ self .camera .resolution .width ,
175+ self .camera .resolution .height ,
176+ )
177+ )
171178
172179 def make_safe (self ):
173180 if self ._acquiring :
@@ -245,11 +252,11 @@ def setLED(self, state=False):
245252 def set_exposure_time (self , value ):
246253 # frame rate has to be adjusted as well as max exposure time is
247254 # 1/framerate.
248- #picam v1.3 I have has limit 1/6 to 90 fps
249- #exposure time can be shorter than frame rate bound but not longer
255+ # picam v1.3 I have has limit 1/6 to 90 fps
256+ # exposure time can be shorter than frame rate bound but not longer
250257 value = min (value , 6.0 )
251- fr = max (value , 1.0 / 90.0 )
252- self .set_framerate (1.0 / fr )
258+ fr = max (value , 1.0 / 90.0 )
259+ self .set_framerate (1.0 / fr )
253260 # exposure times are set in us.
254261 self .camera .shutter_speed = int (value * 1.0e6 )
255262
@@ -264,33 +271,31 @@ def get_cycle_time(self):
264271 # download a frame appears to be .7 s.
265272 return self .camera .exposure_speed * 1.0e-6 + 0.7
266273
267-
268274 def get_framerate (self ):
269- return ( float (self .camera .framerate ) )
275+ return float (self .camera .framerate )
270276
271-
272277 def set_framerate (self , rate ):
273- # rate= max (rate, self.camera.framerate_range.low)
274- # rate= min (rate, self.camera.framerate_range.high)
278+ # rate= max (rate, self.camera.framerate_range.low)
279+ # rate= min (rate, self.camera.framerate_range.high)
275280 self .camera .framerate = rate
276- return ( float (self .camera .framerate ) )
277-
281+ return float (self .camera .framerate )
282+
278283 def _get_sensor_shape (self ):
279284 if self .camversion == "ov5647" : # picam version 1
280285 self .camera .resolution = (2592 , 1944 )
281286 # faqll back to defualt if not set above.
282287 res = self .camera .resolution
283288 return (res .width , res .height )
284289
285- def zoom (self ,roi ):
286- #picamera zoom parameter returns an roi but defined as floats and not
287- #in pixels
288- x = roi [0 ]/ self .camera .resolution .width
289- width = (roi [2 ])/ self .camera .resolution .width
290- y = roi [1 ]/ self .camera .resolution .height
291- height = (roi [3 ])/ self .camera .resolution .height
292- print ("using roi to set zoom" ,roi ,(x ,y , width ,height ))
293- self .camera .zoom = (x ,y , width ,height )
290+ def zoom (self , roi ):
291+ # picamera zoom parameter returns an roi but defined as floats and not
292+ # in pixels
293+ x = roi [0 ] / self .camera .resolution .width
294+ width = (roi [2 ]) / self .camera .resolution .width
295+ y = roi [1 ] / self .camera .resolution .height
296+ height = (roi [3 ]) / self .camera .resolution .height
297+ print ("using roi to set zoom" , roi , (x , y , width , height ))
298+ self .camera .zoom = (x , y , width , height )
294299
295300 def _do_trigger (self ):
296301 self .soft_trigger ()
0 commit comments