Beispiel #1
0
 def _saveImageSequenceToQ(self, aCount, aDeltaTime):
     if self._getCurrentBrightness() < self.brightnessThreshold:
         sensor.activateIRLED() 
     queueFilename = self._getQueueFilename(self.queueIndex)
     captureCount = 0
     while(captureCount < aCount):
         imgPath = self.queuePath + queueFilename + \
             "_" + str(captureCount) + ".jpg"
         self.cam.capture(imgPath)
         captureCount += 1
         time.sleep(aDeltaTime)
     # Increments the index used for filename convention
     self.queueIndex += 1
     # Increments the actual number of image sets in the queue
     self.imgSetsInQ += 1
     sensor.deactivateIRLED()
Beispiel #2
0
    def _doTimelapse(self):

        if self.debug:
            print("Performing timelapse")

        fileName = time.strftime("%Y%m%d-%H%M%S.jpg")
        savePath = os.path.join(self.timelapseFilePath, fileName)
        # tempFilePath = os.path.join(self.tempFilePath,
        #                            self.timelapseLatestImage)
        if self._getCurrentBrightness() < self.brightnessThreshold:
            sensor.activateIRLED()
        self.cam.capture(savePath)
        # TODO(geir): Evaluate if we should apply a visual indication of the
        # current ROI in the image before saving it?

        # Ensure LED is off
        sensor.deactivateIRLED()
Beispiel #3
0
    def _saveImageSequenceToQ(self, aCount, aDeltaTime):

        #TM: Boolean indicates that images are being saved (used by run loop)
        self._savingImageSequence = True

        if self._getCurrentBrightness() < self.brightnessThreshold:
            sensor.activateIRLED()
        queueFilename = self._getQueueFilename(self.queueIndex)
        captureCount = 0
        sequenceTimeStamp = time.strftime("%Y%m%d-%H%M%S")
        while (captureCount < aCount):
            imgPath = self.queuePath + queueFilename + \
                "_" + str(captureCount) + ".jpg"
            pictureCurrentTime = time.time()
            self.cam.capture(imgPath)
            afterPictureCurrentTime = time.time()
            PictureDeltaTime = afterPictureCurrentTime - pictureCurrentTime
            #print PictureDeltaTime
            if (PictureDeltaTime < aDeltaTime):
                time.sleep(aDeltaTime - PictureDeltaTime)
            captureCount += 1
        #TM: records time image taken
        self.sequenceTimeStampList.append(sequenceTimeStamp)

        #TM: records brightness at time image taken
        imageBrightness = self._getCurrentBrightness()
        self.imageBrightnessList.append(imageBrightness)

        # Increments the index used for filename convention
        ##CircularQ
        if self.queueIndex < 999:
            self.queueIndex += 1
        else:
            self.queueIndex = 0
        # Increments the actual number of image sets in the queue
        self.imgSetsInQ += 1
        sensor.deactivateIRLED()

        self._savingImageSequence = False
Beispiel #4
0
    def _doBackgroundRefresh(self):
        if self.strProcessor == "backSub":
            tempFilePath = os.path.join(self.tempFilePath,
                                        self.timelapseLatestImage)
            backgroundCurrentTime = time.time()
            if (backgroundCurrentTime - self.lastBackgroundRefrestTime
                ) > self.backgroundRefreshWaitTime:
                self.lastBackgroundRefrestTime = backgroundCurrentTime
                if self.debug:
                    print("Refreshing background")
                if self._getCurrentBrightness() < self.brightnessThreshold:
                    sensor.activateIRLED()
                self.cam.capture(tempFilePath)

                # IR: Downsample background image
                self.backgroundDownSample(self.downLevel)

                sensor.deactivateIRLED()

            # IR: Reset variables to defaults
            self.resolutionX = self.originalResolutionX
            self.resolutionY = self.originalResolutionY
            self.motionMinArea = self.defaultMotionMinArea