Removed fraction conversion
This commit is contained in:
parent
63336757d4
commit
d4e7d067a3
1 changed files with 0 additions and 19 deletions
|
|
@ -28,9 +28,6 @@ import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# Used for conversion only
|
|
||||||
from fractions import Fraction
|
|
||||||
|
|
||||||
# Pi camera
|
# Pi camera
|
||||||
import picamera
|
import picamera
|
||||||
import picamera.array
|
import picamera.array
|
||||||
|
|
@ -62,21 +59,6 @@ CONFIG_KEYS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Useful methods
|
|
||||||
|
|
||||||
def fractions_to_floats(value):
|
|
||||||
"""Deal with horrible, horrible PiCamera fractions"""
|
|
||||||
result = value
|
|
||||||
if type(value) is list or type(value) is tuple:
|
|
||||||
result = [float(v) if isinstance(v, Fraction) else v for v in value]
|
|
||||||
if type(value) is tuple:
|
|
||||||
result = tuple(result)
|
|
||||||
else:
|
|
||||||
if isinstance(value, Fraction):
|
|
||||||
result = float(value)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
# MAIN CLASS
|
# MAIN CLASS
|
||||||
class StreamingCamera(BaseCamera):
|
class StreamingCamera(BaseCamera):
|
||||||
"""Raspberry Pi camera implementation of StreamingCamera.
|
"""Raspberry Pi camera implementation of StreamingCamera.
|
||||||
|
|
@ -152,7 +134,6 @@ class StreamingCamera(BaseCamera):
|
||||||
for key, _ in self.config['picamera_settings'].items():
|
for key, _ in self.config['picamera_settings'].items():
|
||||||
try:
|
try:
|
||||||
value = getattr(self.camera, key)
|
value = getattr(self.camera, key)
|
||||||
value = fractions_to_floats(value)
|
|
||||||
conf_dict['picamera_settings'][key] = value
|
conf_dict['picamera_settings'][key] = value
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
logging.debug("Unable to read PiCamera attribute {}".format(key))
|
logging.debug("Unable to read PiCamera attribute {}".format(key))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue