コード例 #1
0
    def load_people_from_frame_info(cls, frame_info, date_ref):
        list_people = list()

        params = frame_info[2]['params']

        # Deep copy params to avoid problems
        params_cpy = copy.deepcopy(params)

        found = frame_info[2]['found']

        ticks = ClassUtils.datetime_to_ticks(date_ref)
        counter = 0
        for param in params_cpy:
            cam_number = param['camNumber']
            integrity = param['integrity']
            gpx = param['globalPosition'][0]
            gpy = param['globalPosition'][1]

            # Add elements using valid skeletons
            # Ignore skeletons marked with only pos element
            if integrity and found and 600 >= gpx >= 0 and 698 >= gpy >= -450:
                person_guid = '{0}_{1}_{2}'.format(cam_number, counter, ticks)
                list_people.append(
                    cls(param, date_ref, _person_guid=person_guid))
                counter += 1

        return list_people
コード例 #2
0
    def update_values_from_person(self, person, date_ref):
        self.person_param = person.person_param
        self.last_date = date_ref

        ticks = ClassUtils.datetime_to_ticks(date_ref)
        self._add_pose_to_list(ticks, person.person_param)
        self.update_counter = 0
コード例 #3
0
def main():
    print('Initializing main function')

    date = datetime(2018, 2, 1, 12, 0, 0, 4563)
    print('Date: {0}'.format(date))
    ticks = ClassUtils.datetime_to_ticks(date)

    print('Ticks: {0}'.format(ticks))

    new_date = ClassUtils.ticks_to_datetime(ticks)
    print('New datetime: {0}'.format(new_date))

    print('Done!')
コード例 #4
0
    def __init__(self, _person_param, _date_ref, _person_guid=''):
        self.person_param = _person_param

        self.last_date = _date_ref
        self.list_poses = list()
        self.candidates = list()

        if _person_guid == '':
            self.person_guid = str(uuid.uuid4())
        else:
            self.person_guid = _person_guid

        ticks = ClassUtils.datetime_to_ticks(_date_ref)
        self._add_pose_to_list(ticks, _person_param)

        self.update_counter = 0
コード例 #5
0
    def add_frame(self, image, date_image, json_dict=None):

        if isinstance(image, np.ndarray):
            image_bin = image.tobytes()
        else:
            image_bin = image

        date_file = ClassUtils.get_date_file(date_image)

        if date_file != self.current_date_file:
            self.save_data()
            self.change_extension()
            self.current_date_file = date_file

        ticks = ClassUtils.datetime_to_ticks(date_image)
        file_bytes = ClassUtils.get_bytes_file(ticks, image_bin, json_dict)

        if len(self.buffer) + len(file_bytes) >= buffer_size:
            self.save_data()

        self.buffer += file_bytes