-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About video-gaze mapping procedure #4
Comments
I think one way to solve this would be (keep current time in the class VideoFramesAndMappedGaze:
def __init__(self, gazedata, videoCapture, fps):
self.__cap__ = videoCapture
if (self.__cap__.isOpened() == False):
print("Error opening video stream or file")
raise IOError
self.__current_frameAndMappedGaze__ = None
self.__df__ = gazedata.toDataFrame()
self.__vts__ = gazedata.getVTS()
self.__vts_list__ = self.__vts__.values()
self.__ts_list__ = self.__vts__.keys()
self.__frame_duration__ = int(1000/fps)
self.__current_time__ = self.__vts_list__[0]
self.__i__ = 0
self.__offset__ = self.__ts_list__[0] - self.__vts_list__[0]
def __iter__(self):
return self
def __next__(self):
if (self.__cap__.isOpened()):
ret, frame = self.__cap__.read()
if ret == True:
if self.__current_time__ > self.__vts_list__[self.__i__]:
if self.__i__ < len(self.__vts_list__) - 1:
self.__i__ += 1
self.__offset__ = self.__ts_list__[self.__i__] \
- self.__vts_list__[self.__i__]
T = self.__df__.index[self.__df__.index.get_loc(self.__current_time__\
+ self.__offset__, method='nearest')]
x = self.__df__.at[T, GazeData.GazePixelX]
y = self.__df__.at[T, GazeData.GazePixelY]
else:
raise StopIteration
self.__current_time__ += self.__frame_duration__
return (frame, x, y, T)
else:
raise StopIteration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In
video.py
, theVideoFramesAndMappedGaze
does sync in this way:As I understand it,
current_time
is the current frame'sts
and you are finding the nearestts
in the gaze data.Here, why is the
i
counter being added tocurrent_time
?The text was updated successfully, but these errors were encountered: