浏览代码

histogram approach

Felix Kleinsteuber 3 年之前
父节点
当前提交
fdf054dfe2
共有 4 个文件被更改,包括 90 次插入6 次删除
  1. 67 0
      approach1b_histograms.ipynb
  2. 二进制
      approach1b_results.npy
  3. 4 4
      approach2_background_estimation.ipynb
  4. 19 2
      py/Session.py

文件差异内容过多而无法显示
+ 67 - 0
approach1b_histograms.ipynb


二进制
approach1b_results.npy


文件差异内容过多而无法显示
+ 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):

部分文件因为文件数量过多而无法显示