Example #1
0
void EyeExtractor::process() {
	if(Application::Signals::initiateCalibrationFrameNo == Application::Components::videoInput->frameCount) {
		start();
	}

	if (Application::Components::pointTracker->isTrackingSuccessful()) {
		// Extract eye images using point tracker results
		extractEye(Application::Components::videoInput->frame);
		extractEyeLeft(Application::Components::videoInput->frame);

		// Blink detection
		_blinkDetector.update(eyeFloat);
		_blinkDetectorLeft.update(eyeFloatLeft);

		if (_blinkDetector.getState() >= 2 && _blinkDetectorLeft.getState() >= 2) {
			_isBlinking = true;
		} else {
			_isBlinking = false;
		}
	
		// If calibration is active, collect eye image samples, calculate averages and train the system
		if(Application::Components::calibrator->isActive()) {
			if (Application::Components::calibrator->shouldStartNextPoint()) {
				// Switch to next calibration point
				pointStart();
			} else if (hasValidSample()) {
				// Add the valid training samples
				averageEye->addSample(eyeFloat.get());
				averageEyeLeft->addSample(eyeFloatLeft.get());

				// TODO MOVE ADD SAMPLES TO NN CODE
				//Application::Components::gazeTracker->addSampleToNN(Application::Components::calibrator->getActivePoint(), eyeFloat.get(), eyeGrey.get());
				//Application::Components::gazeTracker->addSampleToNNLeft(Application::Components::calibrator->getActivePoint(), eyeFloatLeft.get(), eyeGreyLeft.get());

				if (Application::Components::calibrator->getPointFrameNo() == Application::dwelltimeParameter - 1) {
					pointEnd();
				
					// TODO : NOT NECESSARY FOR THIS COMPONENT
					//if (Application::Components::calibrator->isLastPoint())
					//	calibrationEnded();
				}
			}
		}
	}
}
Example #2
0
void EyeExtractor::extractEyes(const cv::Mat originalImage) {
	extractEye(originalImage);
	extractEyeLeft(originalImage);
	processEyes();
}