예제 #1
0
 def try_setup(self):
     self.state = 1
     try:
         PiCamera.__init__(self, resolution=(3280, 2464))
     except:
         self.state = 0
     return self.state
예제 #2
0
 def __init__(self, fn="cameraSettings.json"):
     PiCamera.__init__(self)
     with open(fn, "r") as h:
         self.gcSettings = json.load(h)
     self.resolution = self.MAX_RESOLUTION
     self.start_preview(fullscreen=False,
                        resolution=(1024, 768),
                        window=(256, 0, 1024, 768),
                        vflip=False,
                        hflip=False)
     self.gcCamModes = [
         "off", "auto", "night", "nightpreview", "backlight", "spotlight",
         "sports", "snow", "beach", "verylong", "fixedfps", "antishake",
         "fireworks"
     ]
     self.gcAwbModes = [
         "off", "auto", "sunlight", "cloudy", "shade", "tungsten",
         "fluorescent", "incandescent", "flash", "horizon"
     ]
     self.gcMeterModes = ["average", "spot", "backlit", "matrix"]
     self.gcZooms = [
         (0.0, 0.0, 1.0, 1.0), (0.0, 0.0, 0.333, 0.333),
         (0.333, 0.0, 0.333, 0.333), (0.667, 0.0, 0.333, 0.333),
         (0.0, 0.333, 0.333, 0.333), (0.333, 0.333, 0.333, 0.333),
         (0.667, 0.333, 0.333, 0.333), (0.0, 0.667, 0.333, 0.333),
         (0.333, 0.667, 0.333, 0.333), (0.667, 0.667, 0.333, 0.333)
     ]
     # As recommended by the documentation on the raspberri pi camera
     # we have to leave it in automatic a few seconds before setting
     # up manual values.
     sleep(4)
     self.gcApplySettings()
예제 #3
0
    def __init__(self, base_dir='/tmp'):
        PiCamera.__init__(self)

        self.base_dir = base_dir

        self.resolution = (1024, 768)
        self.start_preview()
        self.camera_warmup()
예제 #4
0
    def __init__(self, invert: bool, camera_num: int):
        self.stream = BytesIO()

        PiCamera.__init__(self, camera_num=camera_num, resolution=(1024, 1024))
        if invert:
            self.rotation = 180
        self.start_preview()

        sleep(2)
예제 #5
0
 def __init__(self, diveFolder="./"):
     '''Initiate camera and lock resources'''
     PiCamera.__init__(self)
     self.diveFolder = diveFolder
     self.deployed = False
     self.last_access = 0
     self.stream = None
     self.thread = None
     self.last_frame = None
예제 #6
0
    def __init__(self, resolution=(640.480)):
        '''Constructor for camera'''

        print("Initializing picamera")
        PiCamera.__init__(self, resolution=resolution)
        time.sleep(1)  # Give camera time to start up

        # Set up buffer for capture
        self.rawCapture = PiRGBArray(self)
        self.rawCapture.truncate(0)
        self.rawCapture.seek(0)
예제 #7
0
    def __init__(self, size):
        PiCamera.__init__(self)
        self.size = size
        self.resolution = size
        self.framerate = 25
        self.rotation = -90
        self.hflip = True
        self.foreground = 2
        self.background = 1
        self.overlay = None

        self.small_window = (0, 0, 640, 480)
예제 #8
0
    def __init__(self, diveFolder="./"):
        '''Initiate camera and lock resources'''
        PiCamera.__init__(self)
        self.diveFolder=diveFolder
        self.deployed=False
        self.last_access=0
        self.stream = None
        self.thread = None
        self.last_frame = None

        # 180 corresponds with normal orrientation in lab
        self.rotation=180
예제 #9
0
파일: Display.py 프로젝트: JonasKunze/raspi
    def __init__(self, size):
        PiCamera.__init__(self) 
        self.size = size
        self.resolution = size 
        self.framerate = 25 
        self.rotation = -90
        self.hflip = True
        self.foreground = 2
        self.background = 1
        self.overlay = None

        self.small_window = (0, 0, 640, 480)
예제 #10
0
    def __init__(self,
                 sonar=None,
                 clientAddr=None,
                 clientPort=5555,
                 resolution=(640, 480)):
        PiCamera.__init__(self)
        self.resolution = resolution
        self.mode = None
        self.sonar = sonar

        self.rawCapture = PiRGBArray(self)
        self.rawCapture.truncate(0)
        self.rawCapture.seek(0)
예제 #11
0
    def __init__(self, camera_num: int, invert: bool):
        PiCamera.__init__(self, camera_num=camera_num, resolution=(512, 512))
        if invert:
            self.rotation = 180
        self.framerate = 32
        self.last_image = None
        self.updated = False
        self.stopped = False
        self.__capture_stream = BytesIO()
        self.__capture_stream.seek(0)
        self.__camera_thread = Thread(target=self.__update)

        # Let camera warm up
        time.sleep(1)
예제 #12
0
파일: deepi.py 프로젝트: rshom/DEEPiV1.0
    def __init__(self, diveFolder=None):

        if diveFolder == None:
            currentDate = datetime.datetime.utcnow().isoformat()[:-10]
            diveFolder = currentDate.replace('-', '').replace(':', '')

        self.path = '{}/{}/'.format(os.getcwd(), diveFolder)
        try:
            os.mkdir(self.path)
        except:
            print("Unable to create divefolder")
            self.path = ''

        print("Saving files at: {}".format(self.path))
        Camera.__init__(self)
        time.sleep(2)  # Allow camera to initiate
예제 #13
0
 def __init__(self, framecount=0, fn="cameraSettings.json"):
     self.framecount = framecount
     PiCamera.__init__(self)
     with open(fn, "r") as h:
         self.gcSettings = json.load(h)
     with open("captureModes.json", "r") as h:
         self.captureModes = json.load(h)
     with open("previewSettings.json", "r") as p:
         self.previewSettings = json.load(p)
         p = self.previewSettings
     self.resolution = self.MAX_RESOLUTION
     self.start_preview(fullscreen=False,
                        resolution=(p["width"], p["height"]),
                        window=(p["offsetX"], p["offsetY"], p["width"],
                                p["height"]),
                        vflip=False,
                        hflip=False)
     self.gcCamModes = [
         "off", "auto", "night", "nightpreview", "backlight", "spotlight",
         "sports", "snow", "beach", "verylong", "fixedfps", "antishake",
         "fireworks"
     ]
     self.gcAwbModes = [
         "off", "auto", "sunlight", "cloudy", "shade", "tungsten",
         "fluorescent", "incandescent", "flash", "horizon"
     ]
     self.gcMeterModes = ["average", "spot", "backlit", "matrix"]
     self.gcZooms = [
         (0.0, 0.0, 1.0, 1.0), (0.0, 0.0, 0.333, 0.333),
         (0.333, 0.0, 0.333, 0.333), (0.667, 0.0, 0.333, 0.333),
         (0.0, 0.333, 0.333, 0.333), (0.333, 0.333, 0.333, 0.333),
         (0.667, 0.333, 0.333, 0.333), (0.0, 0.667, 0.333, 0.333),
         (0.333, 0.667, 0.333, 0.333), (0.667, 0.667, 0.333, 0.333)
     ]
     # As recommended by the documentation on the raspberri pi camera
     # we have to leave it in automatic a few seconds before setting
     # up manual values.
     sleep(4)
     self.gcApplySettings()
     self.captureMode = self.gcSettings["captureMode"]
     self.suffix = self.captureModes[self.captureMode]["suffix"]
     self.DNG = RPICAM2DNG()
예제 #14
0
    def __init__(self, shutter_speed: int, framerate: int, iso: int,
                 saturation: int, sharpness: int, contrast: int,
                 brightness: int) -> object:

        PiCamera.__init__(self)
        """
            #mostly turns off all camera properties
            self.flash_modes = 'off'
            self.exposure_mods = 'night'
            self.awb_modes = 'off'
            self.image_effects = 'negativ'
            self.drc_settings = 'off'
            self.stereo_mods = 'off' """

        self.resolution = (640, 480)
        self.shutter_speed = shutter_speed  #скорость затвора
        self.framerate = framerate  #fps
        #self.iso = iso #баланс белого
        self.iso = iso
        self.saturation = saturation  #насыщенность
        self.sharpness = sharpness  #резкость
        self.contrast = contrast  #контраст
        self.brightness = brightness  #яркость
예제 #15
0
 def __init__(self):
     PiCamera.__init__(self)
     #self.menu()
     self.takepic()
	def __init__(self, config = None):
		"""add a config constructor"""
		PiCamera.__init__(self)
		if config:
			self.config(config)
예제 #17
0
 def __init__(self, server, resolution, framerate):
     PiCamera.__init__(self, resolution=resolution, framerate=framerate)
     self.server = server
     self.compid = None
     self.capturing = Event()
예제 #18
0
 def __init__(self):
     self.log = logging.getLogger('webcam.Camera')
     self.log.info('Instantiate camera.')
     PiCamera.__init__(self)
     self.configureHighRes()