Explorar o código

histogram approach

Felix Kleinsteuber %!s(int64=3) %!d(string=hai) anos
pai
achega
fdf054dfe2
Modificáronse 4 ficheiros con 90 adicións e 6 borrados
  1. 67 0
      approach1b_histograms.ipynb
  2. BIN=BIN
      approach1b_results.npy
  3. 4 4
      approach2_background_estimation.ipynb
  4. 19 2
      py/Session.py

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 67 - 0
approach1b_histograms.ipynb


BIN=BIN
approach1b_results.npy


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 4 - 4
approach2_background_estimation.ipynb


+ 19 - 2
py/Session.py

@@ -216,6 +216,15 @@ class Session:
         # end of all time series
         yield imgs
 
+    def generate_motion_images(self):
+        """Yields all motion images in this session.
+
+        Yields:
+            MotionImage: A MotionImage
+        """
+        for file, date in self.motion_dates.items():
+            yield MotionImage(self, file, date)
+
     
     def get_closest_lapse_images(self, motion_file: str):
         """Returns the lapse images taken closest before and after this image, respectively.
@@ -239,7 +248,7 @@ class Session:
                 previous_date = None
                 break
         i = 0
-        while not next_date in self.lapse_map and i < 24:
+        while not next_date in self.lapse_map:
             next_date += timedelta(hours=1)
             i += 1
             if i > 24:
@@ -305,8 +314,16 @@ class MotionImage(SessionImage):
 
     def get_closest_lapse_images(self):
         before, after = self.session.get_closest_lapse_images(self.filename)
+        rel = -1
         # rel = 0 if motion image was taken at before lapse image, rel = 1 if motion image was taken at after lapse image
-        rel = (self.date - before.date).total_seconds() / (after.date - before.date).total_seconds()
+        if before is None and after is not None:
+            rel = 1
+        elif before is not None and after is None:
+            rel = 0
+        elif before is not None and after is not None:
+            rel = (self.date - before.date).total_seconds() / (after.date - before.date).total_seconds()
+        else:
+            warn("No before and no after image!")
         return before, after, rel
         
 class LapseImage(SessionImage):

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio