# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# <h1><center>Report 13</center></h1>
# <h3><center><NAME></center><h3>

# # Introduction
# The glint detection is done, as well as the first attempt for data filtering and live plots updates for the user interface.

# # Setup
# Setup path to include our files. import them. use `autoreload` to get changes in as they are made. 

# +
import os
import sys
import cv2
from matplotlib import pyplot as plt
import statistics 
import numpy as np

# load our code
sys.path.insert(0, os.path.abspath('../'))
from plotting import auto_draw
# specific to jupyter notebook
from jupyter_help import cvplt, cvplt_sub
#Import image processing function from optimization
# load any changes as we make them
# %load_ext autoreload
# %autoreload 2
# -

# # Results showcase
# Original pupil plot with filtered pupil plot.
# Original glint plot with filtered glint plot.
#
# The filtered plots are lag behind original plots because for the zscore to work, I set the boundary to be 2000 before the data is stored all together into the file.

#Read in the original image
image1 = cv2.imread("../plotting/origin_x_pupil.png")
image2 = cv2.imread("../plotting/filtered_x_pupil.png")
#Showing x_pupil
cvplt_sub([image1, image2],1 ,2)

#Showing y_pupil
image3 = cv2.imread("../plotting/origin_y_pupil.png")
image4 = cv2.imread("../plotting/filtered_y_pupil.png")
cvplt_sub([image3, image4],1 ,2)

#Showing r pupil
image5 = cv2.imread("../plotting/origin_r_pupil.png")
image6 = cv2.imread("../plotting/filtered_r_pupil.png")
cvplt_sub([image5, image6],1 ,2)

#Showing blink
image7 = cv2.imread("../plotting/blink_pupil.png")
cvplt(image7)

#Showing x_glint
image8 = cv2.imread("../plotting/origin_x_glint.png")
image9 = cv2.imread("../plotting/filtered_x_glint.png")
cvplt_sub([image8, image9],1 ,2)

#Showing y_glint
image10 = cv2.imread("../plotting/origin_y_glint.png")
image11 = cv2.imread("../plotting/filtered_y_glint.png")
cvplt_sub([image10, image11],1 ,2)

#Showing r_glint
image12 = cv2.imread("../plotting/origin_r_glint.png")
image13 = cv2.imread("../plotting/filtered_r_glint.png")
cvplt_sub([image12, image13],1 ,2)

# # Analysis
# Ideally, there are going to be three filters to show the optimal plots for user to see. However, with the current data set, computer would be able to distinguish the staring directions.

# # Conclusion
# The hardest part for this research is almost done. However, a new issue pops up that when the target falls asleep and their heads drop, the glint would in some cases be covered by the noises and the whole parameters would change. Solution: Impose another filter.

StarcoderdataJupyterScriptsDedupFiltered