Permalink
Browse files

Removing unnecessary code

  • Loading branch information...
1 parent a874df9 commit 236fcd70dd65ed8b620befd67846a9aabae84c45 @errollw committed Feb 25, 2014
Showing with 19 additions and 30 deletions.
  1. +13 −24 EyeTab/EyeTab.cpp
  2. +3 −3 EyeTab/gaze_geometry.cpp
  3. +1 −1 EyeTab/gaze_smoothing.cpp
  4. +1 −1 EyeTab/gaze_smoothing.h
  5. +1 −1 EyeTab/gaze_system.cpp
View
@@ -6,8 +6,8 @@
#include <iostream>
#include <stdio.h>
-#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */
-#include <math.h> /* floor */
+#include <time.h>
+#include <math.h>
#include "eye_center.h"
#include "erase_specular.h"
@@ -26,55 +26,44 @@ String screenshot_filename;
int main(int argc, const char** argv)
{
- // init modules
+ // initialize modules
lin_polar_init();
gaze_system_init();
- //init_gaze_smoothing();
+ gaze_smoothing_init();
- //setup video capture device
+ // start reading in camera frames (720p video)
VideoCapture cap("videos\\sample_video.mp4");
- // VideoCapture cap("C:\\Users\\Erroll\\Documents\\Part 3 Project (local)\\Gaze Data\\P03\\P03_L1_D1_20130517_163141.mp4");
- // VideoCapture cap("C:\\Users\\Erroll\\Documents\\Part 3 Project (local)\\Gaze Data\\P06\\P06_L1_D1_20130520_154535.mp4");
-
- int cam_idx = argc > 1 ? atoi(argv[1]) : 0;
- //VideoCapture cap(CV_CAP_DSHOW + 0);
- cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280);
- cap.set(CV_CAP_PROP_FRAME_HEIGHT, 720);
- //setup image files used in the capture process
+ // setup image files used in the capture process
Mat captureFrame, grayscaleFrame, smallFrame;
- //create a window to present the results
- namedWindow("outputCapture", 1);
- //namedWindow("Gaze Output", 1);
- //moveWindow("Gaze Output", 0, 0);
+ // create a window to present the results
+ namedWindow("output", 1);
- //create a loop to capture and find eye-pairs
+ // main loop
while(true)
{
clock_t start = clock();
- //capture a new image frame
+ // read in a new image frame
cap >> captureFrame;
// captureFrame = imread("images\\SS_0.jpg", CV_LOAD_IMAGE_COLOR);
- // flip(captureFrame,captureFrame,1);
- //if (rot_180)
flip(captureFrame, captureFrame, -1);
- //convert captured image to gray scale and equalize
+ // convert captured image to equalized gray scale
cvtColor(captureFrame, grayscaleFrame, CV_BGR2GRAY);
equalizeHist(grayscaleFrame, grayscaleFrame);
track_gaze(captureFrame, grayscaleFrame);
- // Show calculated FPS
+ // show calculated FPS (two draw functions to simulate text shadow)
String fps_string = to_string(int(1 / ( ((float)clock()-start) / CLOCKS_PER_SEC ))) + " FPS";
putText(captureFrame, fps_string, Point2i(11, 21), FONT_HERSHEY_SIMPLEX, 0.5, BLACK);
putText(captureFrame, fps_string, Point2i(10, 20), FONT_HERSHEY_SIMPLEX, 0.5, WHITE);
// Show the output
- imshow("outputCapture", captureFrame);
+ imshow("output", captureFrame);
switch (waitKey(5)){
case 's':
View
@@ -53,7 +53,7 @@ vector<Vector3d> ellipse_to_limbus(cv::RotatedRect ellipse){
//limb_normal = rot1 * limb_normal;
//limb_normal = rot2 * limb_normal;
- // Ignore other possible normal - found in practise to be wrong in general
+ // Ignore other possible normal - wrong in general as will point the wrong direction
Vector3d limb_normal(sin(tht_1) * cos(psi), -sin(tht_1) * sin(psi), -cos(tht_1));
// Now correct for weak perspective by modifying angle by offset between camera axis and limbus
@@ -88,9 +88,9 @@ Point2d get_gaze_pt_mm(RotatedRect& ellipse){
return p;
}
-const Size SCREEN_SIZE_MM(256,144);
+const Size SCREEN_SIZE_MM(236, 134);
const Size SCREEN_SIZE_PX(1920, 1080); // Screen size in pixels
-const Point2i CAMERA_OFFSET_MM(128, 155); // Vector from camera to top left of screen
+const Point2i CAMERA_OFFSET_MM(120, 140); // Vector from camera to top left of screen
Point2i convert_gaze_pt_mm_to_px(Point2d gaze_pt_mm){
@@ -18,7 +18,7 @@ vector<Point2d> point_history;
vector<float> weights;
float weight_sum = 0;
-void init_gaze_smoothing(){
+void gaze_smoothing_init(){
for (float i = 1; i < SMOOTHING_WINDOW_SIZE; i++){
weights.push_back(i);
weight_sum += i;
View
@@ -1,6 +1,6 @@
using namespace std;
using namespace cv;
-void init_gaze_smoothing();
+void gaze_smoothing_init();
Point2d smooth_gaze(Point2d gaze_point);
View
@@ -116,7 +116,7 @@ void track_gaze(Mat& frame_bgr, Mat& frame_gray) {
Sobel(frame_gray(eye1_roi_ref), grad_y, CV_32F, 0, 1, 5);
RotatedRect ellipse1 = fit_ellipse(poss_limb_pts_1, grad_x, grad_y);
- // Shift ellipses fit
+ // Shift ellipses fit by their ROI offset
ellipse0 = RotatedRect(Point2i(ellipse0.center) + eye0_roi_ref.tl(), ellipse0.size, ellipse0.angle);
ellipse1 = RotatedRect(Point2i(ellipse1.center) + eye1_roi_ref.tl(), ellipse1.size, ellipse1.angle);

0 comments on commit 236fcd7

Please sign in to comment.