Пример #1
0
 def create_fixation_pixellist(self, fixation_list):
     # return list of (hi, wi) coord
     pixel_list = []
     for time, v, _, _ in fixation_list:
         theta, phi = head_orientation_lib.vector_to_ang(v)
         x, y = head_orientation_lib.ang_to_geoxy(theta, phi, head_orientation_lib.H, head_orientation_lib.W)
         pixel_list.append((x, y))
     return pixel_list
Пример #2
0
 def pixellist_from_v_list(v_list):
     #note, pixellist need to compatible with dataset
     #dataset 2: fliplr
     #dataset 1: maybe flipud
     
     pixel_list = []
     for v in v_list:
         theta, phi = head_orientation_lib.vector_to_ang(v)
         hi, wi = head_orientation_lib.ang_to_geoxy(theta, phi, head_orientation_lib.H, head_orientation_lib.W)
         pixel_list.append([hi, wi])
     return pixel_list
Пример #3
0
 def create_fixation_pixelset(self, fixation_list):
     # return set of (hi, wi) coord, eliminate redundancy
     pixel_set = set()
     orifix_list = []
     for time, v, _, _ in fixation_list:
         theta, phi = head_orientation_lib.vector_to_ang(v)
         x, y = head_orientation_lib.ang_to_geoxy(theta, phi, head_orientation_lib.H, head_orientation_lib.W)
         if (int(x), int(y)) not in pixel_set:
             pixel_set.add((int(x), int(y)))
             orifix_list.append([time, v, 0, 0])
     return pixel_set, orifix_list    
Пример #4
0
                series_t = []
                series_v = []
                print(f, end='\r')
                for item in vector:
                    if item[0] == f:
                        series_t.append(item[0])
                        series_v.append(item[1])

                if (len(series_t) != 0):
                    mean_series_t = np.mean(np.array(series_t)) * dt
                    mean_series_v = np.mean(np.array(series_v), axis=0)

                    theta, phi = head_orientation_lib.vector_to_ang(
                        mean_series_v)
                    x, y = head_orientation_lib.ang_to_geoxy(
                        theta, phi, head_orientation_lib.H,
                        head_orientation_lib.W)

                    viewport.append([mean_series_t, (x, y)])

            pickle.dump(
                viewport,
                open(
                    PATH + 'viewport_ds{}_topic{}_user{}'.format(
                        dataset, topic, user), 'wb'))
            user += 1
    else:
        user = 1
        for vector in vector_ds:
            viewport = []
            print("Usernum={}".format(user))