Exemplo n.º 1
0
        public PupilFinder(string videoFileName, System.Windows.Controls.ProgressBar progressBar, System.Windows.Shell.TaskbarItemInfo taskbar,
                           SetStatusDelegate setStatus, FrameProcessedDelegate updateFrame, FramesProcessedDelegate framesProcessed)
        {
            this.videoFileName      = videoFileName;
            this.progressBar        = progressBar;
            SetStatus               = setStatus;
            UpdateFrame             = updateFrame;
            OnFramesPupilsProcessed = framesProcessed;
            this.taskbar            = taskbar;
            videoSource             = new VideoCapture(videoFileName);
            width      = (int)videoSource.Get(VideoCaptureProperties.FrameWidth);
            height     = (int)videoSource.Get(VideoCaptureProperties.FrameHeight);
            fps        = (int)videoSource.Get(VideoCaptureProperties.Fps);
            frameCount = (int)videoSource.Get(VideoCaptureProperties.FrameCount);
            duration   = frameCount / fps;

            // try to auto load stuff if they exist
            if (File.Exists(autoTimestampFileName))
            {
                LoadTimestamps(autoTimestampFileName);
                isTimestampParsed = true;
            }
            else
            {
                timeStamps = Num.zeros((frameCount, 4), NPTypeCode.Int32);
            }

            if (File.Exists(autoPupilsFileName))
            {
                LoadPupilLocations(autoPupilsFileName);
            }
            else
            {
                pupilLocations  = Num.zeros((frameCount, 4), NPTypeCode.Double);
                pupilLocations *= Num.NaN;                      // use NaN to indicate pupil not yet found on this frame
            }

            cvFrame = new Mat();
            for (int i = 0; i < 3; i++)
            {
                colorChannels[i] = new Mat();
            }

            red = colorChannels[0];

            top    = 0;
            left   = 0;
            right  = width;
            bottom = height;

            isFrameProcessed = new bool[frameCount];
            for (int i = 0; i < frameCount; i++)
            {
                isFrameProcessed[i] = false;
            }
        }
Exemplo n.º 2
0
 public HoughPupilFinder(string videoFileName, System.Windows.Controls.ProgressBar progressBar, System.Windows.Shell.TaskbarItemInfo taskbar,
                         SetStatusDelegate setStatus, FrameProcessedDelegate updateFrame, FramesProcessedDelegate framesProcessed)
     : base(videoFileName, progressBar, taskbar, setStatus, updateFrame, framesProcessed)
 {
 }