コード例 #1
0
 def duplicate_calibration(self, calibration):
     new_calibration = copy.deepcopy(calibration)
     new_calibration.name = make_unique.by_number_at_end(
         new_calibration.name + " Copy", self.item_names
     )
     new_calibration.unique_id = model.Calibration.create_new_unique_id()
     return new_calibration
コード例 #2
0
 def _load_recorded_calibrations(self):
     notifications = fm.load_pldata_file(self._rec_dir, "notify")
     for topic, data in zip(notifications.topics, notifications.data):
         if topic == "notify.calibration.calibration_data":
             try:
                 calib_result = model.CalibrationResult(
                     mapping_plugin_name=data["mapper_name"],
                     mapper_args=dict(data["mapper_args"]),
                 )
             except KeyError:
                 # notifications from old recordings will not have these fields!
                 continue
             mapping_method = "2d" if "2d" in data[
                 "calibration_method"] else "3d"
             # the unique id needs to be the same at every start or otherwise the
             # same calibrations would be added again and again. The timestamp is
             # the easiest datum that differs between calibrations but is the same
             # for every start
             unique_id = model.Calibration.create_unique_id_from_string(
                 str(data["timestamp"]))
             calibration = model.Calibration(
                 unique_id=unique_id,
                 name=make_unique.by_number_at_end("Recorded Calibration",
                                                   self.item_names),
                 recording_uuid=self._recording_uuid,
                 mapping_method=mapping_method,
                 frame_index_range=self._get_recording_index_range(),
                 minimum_confidence=0.8,
                 is_offline_calibration=False,
                 result=calib_result,
             )
             self.add(calibration)
コード例 #3
0
 def _load_recorded_calibrations(self):
     notifications = fm.load_pldata_file(self._rec_dir, "notify")
     for topic, data in zip(notifications.topics, notifications.data):
         if topic == "notify.calibration.calibration_data":
             try:
                 calib_result = model.CalibrationResult(
                     mapping_plugin_name=data["mapper_name"],
                     mapper_args=dict(data["mapper_args"]),
                 )
             except KeyError:
                 # notifications from old recordings will not have these fields!
                 continue
             mapping_method = "2d" if "2d" in data["calibration_method"] else "3d"
             # the unique id needs to be the same at every start or otherwise the
             # same calibrations would be added again and again. The timestamp is
             # the easiest datum that differs between calibrations but is the same
             # for every start
             unique_id = model.Calibration.create_unique_id_from_string(
                 str(data["timestamp"])
             )
             calibration = model.Calibration(
                 unique_id=unique_id,
                 name=make_unique.by_number_at_end(
                     "Recorded Calibration", self.item_names
                 ),
                 recording_uuid=self._recording_uuid,
                 mapping_method=mapping_method,
                 frame_index_range=self._get_recording_index_range(),
                 minimum_confidence=0.8,
                 is_offline_calibration=False,
                 result=calib_result,
             )
             self.add(calibration)
コード例 #4
0
 def create_default_calibration(self):
     return model.Calibration(
         unique_id=model.Calibration.create_new_unique_id(),
         name=make_unique.by_number_at_end("Default Calibration", self.item_names),
         recording_uuid=self._recording_uuid,
         mapping_method="3d",
         frame_index_range=self._get_recording_index_range(),
         minimum_confidence=0.8,
     )
コード例 #5
0
 def create_default_calibration(self):
     return model.Calibration(
         unique_id=model.Calibration.create_new_unique_id(),
         name=make_unique.by_number_at_end("Default Calibration",
                                           self.item_names),
         recording_uuid=self._recording_uuid,
         mapping_method="3d",
         frame_index_range=self._get_recording_index_range(),
         minimum_confidence=0.8,
     )
コード例 #6
0
 def create_default_calibration(self):
     return model.Calibration(
         unique_id=model.Calibration.create_new_unique_id(),
         name=make_unique.by_number_at_end("Default Calibration",
                                           self.item_names),
         recording_uuid=self._recording_uuid,
         gazer_class_name=default_gazer_class.__name__,
         frame_index_range=self._get_recording_index_range(),
         minimum_confidence=0.8,
         is_offline_calibration=True,
         status="Not calculated yet",
     )
コード例 #7
0
 def create_default_gaze_mapper(self):
     default_calibration = self._calibration_storage.get_first_or_none()
     if default_calibration:
         calibration_unique_id = default_calibration.unique_id
     else:
         calibration_unique_id = ""
     return model.GazeMapper(
         unique_id=model.GazeMapper.create_new_unique_id(),
         name=make_unique.by_number_at_end("Default Gaze Mapper", self.item_names),
         calibration_unique_id=calibration_unique_id,
         mapping_index_range=self._get_recording_index_range(),
         validation_index_range=self._get_recording_index_range(),
         validation_outlier_threshold_deg=5.0,
     )
コード例 #8
0
 def create_default_gaze_mapper(self):
     default_calibration = self._calibration_storage.get_first_or_none()
     if default_calibration:
         calibration_unique_id = default_calibration.unique_id
     else:
         calibration_unique_id = ""
     return model.GazeMapper(
         unique_id=model.GazeMapper.create_new_unique_id(),
         name=make_unique.by_number_at_end("Default Gaze Mapper", self.item_names),
         calibration_unique_id=calibration_unique_id,
         mapping_index_range=self._get_recording_index_range(),
         validation_index_range=self._get_recording_index_range(),
         validation_outlier_threshold_deg=5.0,
     )
コード例 #9
0
 def duplicate_gaze_mapper(self, gaze_mapper):
     return model.GazeMapper(
         unique_id=gaze_mapper.create_new_unique_id(),
         name=make_unique.by_number_at_end(gaze_mapper.name + " Copy",
                                           self.item_names),
         calibration_unique_id=gaze_mapper.calibration_unique_id,
         mapping_index_range=gaze_mapper.mapping_index_range,
         validation_index_range=gaze_mapper.validation_index_range,
         validation_outlier_threshold_deg=gaze_mapper.
         validation_outlier_threshold_deg,
         manual_correction_x=gaze_mapper.manual_correction_x,
         manual_correction_y=gaze_mapper.manual_correction_y,
         activate_gaze=gaze_mapper.activate_gaze,
         # We cannot deep copy gaze, so we don't.
         # All others left at their default.
     )
コード例 #10
0
 def duplicate_gaze_mapper(self, gaze_mapper):
     return model.GazeMapper(
         unique_id=gaze_mapper.create_new_unique_id(),
         name=make_unique.by_number_at_end(
             gaze_mapper.name + " Copy", self.item_names
         ),
         calibration_unique_id=gaze_mapper.calibration_unique_id,
         mapping_index_range=gaze_mapper.mapping_index_range,
         validation_index_range=gaze_mapper.validation_index_range,
         validation_outlier_threshold_deg=gaze_mapper.validation_outlier_threshold_deg,
         manual_correction_x=gaze_mapper.manual_correction_x,
         manual_correction_y=gaze_mapper.manual_correction_y,
         activate_gaze=gaze_mapper.activate_gaze,
         # We cannot deep copy gaze, so we don't.
         # All others left at their default.
     )
コード例 #11
0
ファイル: calibration_storage.py プロジェクト: pfaion/pupil
    def __create_prerecorded_calibration(
            self, result_notification: CalibrationResultNotification):
        timestamp = result_notification.timestamp

        # the unique id needs to be the same at every start or otherwise the
        # same calibrations would be added again and again. The timestamp is
        # the easiest datum that differs between calibrations but is the same
        # for every start
        unique_id = model.Calibration.create_unique_id_from_string(
            str(timestamp))
        name = make_unique.by_number_at_end("Recorded Calibration",
                                            self.item_names)
        return model.Calibration(
            unique_id=unique_id,
            name=name,
            recording_uuid=self._recording_uuid,
            gazer_class_name=result_notification.gazer_class_name,
            frame_index_range=self._get_recording_index_range(),
            minimum_confidence=0.8,
            is_offline_calibration=True,
            status="Not calculated yet",
            calib_params=result_notification.params,
        )
コード例 #12
0
 def duplicate_calibration(self, calibration):
     new_calibration = copy.deepcopy(calibration)
     new_calibration.name = make_unique.by_number_at_end(
         new_calibration.name + " Copy", self.item_names)
     new_calibration.unique_id = model.Calibration.create_new_unique_id()
     return new_calibration