JeVoisBase  1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
EyeTracker.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4 // California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5 //
6 // This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7 // redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8 // Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10 // License for more details. You should have received a copy of the GNU General Public License along with this program;
11 // if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12 //
13 // Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14 // Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16 /*! \file */
17 
18 #pragma once
19 
21 #include <opencv2/core/core.hpp>
22 #include <cvEyeTracker-1.2.5/ransac_ellipse.h>
23 
24 namespace eyetracker
25 {
26  static jevois::ParameterCategory const ParamCateg("Eye Tracker Options");
27 
28  //! Parameter \relates EyeTracker
29  JEVOIS_DECLARE_PARAMETER(edgethresh, unsigned char, "Pupil edge threshold",
30  20, ParamCateg);
31 
32  //! Parameter \relates EyeTracker
33  JEVOIS_DECLARE_PARAMETER(numrays, int, "Number of rays",
34  18, jevois::Range<int>(4, 180), ParamCateg);
35 
36  //! Parameter \relates EyeTracker
37  JEVOIS_DECLARE_PARAMETER(mincand, int, "Minimum number of feature candidates",
38  10, jevois::Range<int>(1, 50), ParamCateg);
39 
40  //! Parameter \relates EyeTracker
41  JEVOIS_DECLARE_PARAMETER(corneal, int, "Corneal window size",
42  51, /* FIXME enforce odd */ ParamCateg); // FIXME frameh
43 }
44 
45 //! Eye-tracker class used to detect gaze direction from close-up video of one's eye
46 /*! The original eye tracking software used here can be found at http://thirtysixthspan.com/openEyes/software.html
47  \ingroup components */
49  public jevois::Parameter<eyetracker::edgethresh, eyetracker::numrays, eyetracker::mincand,
50  eyetracker::corneal>
51 {
52  public:
53  //! Constructor
54  EyeTracker(std::string const & instance);
55 
56  //! Destructor
57  virtual ~EyeTracker();
58 
59  //! Process grayscale byte image from camera
60  /*! Note: we will draw the detected ellipse and a few more things in the image.
61 
62  pupell will be filled with the pupil ellipse params, in the order used by opencv to draw ellipses: a, b, cx, cy,
63  theta. */
64  void process(cv::Mat & eyeimg, double pupell[5], bool debugdraw = false);
65 
66  private:
67  int currWidth, currHeight;
68  double *intensity_factor_hori; //horizontal intensity factor for noise reduction
69  double *avg_intensity_hori; //horizontal average intensity
70  stuDPoint start_point;
71  double pupil_param[5];
72  std::vector <stuDPoint> edge_point;
73 };
jevois::Range
JEVOIS_DECLARE_PARAMETER
JEVOIS_DECLARE_PARAMETER(thresh1, double, "First threshold for hysteresis", 50.0, ParamCateg)
jevois::Component
EyeTracker::~EyeTracker
virtual ~EyeTracker()
Destructor.
Definition: EyeTracker.C:147
jevois::ParameterCategory
Component.H
EyeTracker::process
void process(cv::Mat &eyeimg, double pupell[5], bool debugdraw=false)
Process grayscale byte image from camera.
Definition: EyeTracker.C:154
EyeTracker::EyeTracker
EyeTracker(std::string const &instance)
Constructor.
Definition: EyeTracker.C:141
eyetracker
Definition: EyeTracker.H:24
EyeTracker
Eye-tracker class used to detect gaze direction from close-up video of one's eye.
Definition: EyeTracker.H:48