EducationalTestingService / Confero

Eye-tracking, Screen and Event Capturing System for Windows. A web application running on a separate PC allows for real time monitoring of the users actions.
GNU General Public License v3.0
9 stars 1 forks source link

SSA: having multiple gaze cursors on the screen #104

Closed garyfeng closed 8 years ago

garyfeng commented 8 years ago

In rare cases, you may see multiple static gaze cursors on the screen, with only one moving. This is caused by invalid time code in the SSA files. Scroll down the offending SSA file, you will see lines shorter than others, with incomplete time like the following:

Dialogue:0,0:36:05.96,0:3,Default,,0000,0000,0000,,{\pos(1086,208)\an5}+

Tracked this down to the following lines in vidvec2ssa.py in function createSSA. Looks like timeselta creates the shorted string without the microscend representation in some cases -- likely when the microsecond happens to be exactly zero. Can't find bug reports online, though

I put in a temporary fix, see below.

                    # garyfeng: fixing a bug where timestamp doesn't have the trailing msc and microsec
                    #   when (I guess) the fraction is exactly 000000. for example:
                    #0:36:05.965820
                    #0:36:06
                    # Dialogue:0,0:36:05.96,0:3,Default,,0000,0000,0000,,{\pos(1086,208)\an5}+
                    # we detect this case and add trailing 0s
                    strStart = str(timestamp_start)
                    strEnd = str(timestamp_end)
                    if (len(strStart)<10):
                        strStart+=".000000"
                    if (len(strEnd)<10):
                        strEnd+=".000000"
                    # end garyfeng

                    # garyfeng: why not do it earlier with vid_frame_samples
                    #gaze_y = sheight - (frame_sample['gaze_y'] + sheight/2)
                    output_file.write('Dialogue:{0},{1},{2},Default,,0000,0000,0000,,{{\\pos({3},{4})\\an5}}+\n'.format(eye_num,
                                                                    unicode(strStart)[:-4],
                                                                    unicode(strEnd)[:-4],
                                                                    int(round(frame_sample['gaze_x'])),
                                                                    int(round(frame_sample['gaze_y']))
                                                                    )
                                     )