|
|
@@ -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':
|
|
|
|
0 comments on commit
236fcd7