コード例 #1
0
void GazeTrackerHistogramFeatures::process() {

	if (!Application::Components::pointTracker->isTrackingSuccessful()) {
		return;
	}
	

	// Segmentacion, histogram extraction
	// If recalibration is necessary (there is a new target), recalibrate the Gaussian Processes
	if(Application::Components::calibrator->needRecalibration) {
		std::cout << "HIST FEATURES NEED RECALIB!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
		addExemplar();
	}

	if(Application::Components::calibrator->isActive()
		&& Application::Components::calibrator->getPointFrameNo() >= 11
		&& !Application::Components::eyeExtractor->isBlinking()) {

		// ARCADI PROCESS
        vectorOfVectors_horizontal.push_back(Application::Components::eyeSegmentation->vector_horizontal);
        vectorOfVectors_vertical.push_back(Application::Components::eyeSegmentation->vector_vertical);
        vectorOfVectors_horizontal_left.push_back(Application::Components::eyeSegmentation->vector_horizontal_left);
        vectorOfVectors_vertical_left.push_back(Application::Components::eyeSegmentation->vector_vertical_left);
        // ARCADI PROCESS

/*
		// Add current sample (not the average, but sample from each usable frame) to the vector
		cv::Mat *temp = new cv::Mat(EyeExtractor::eyeSize, CV_32FC1);
		Application::Components::eyeExtractor->eyeFloat->copyTo(*temp);

		Utils::SharedImage temp2(new cv::Mat(temp->size(), temp->type()), Utils::releaseImage);
		_calibrationTargetImagesAllFrames.push_back(temp2);
		
		// Repeat for left eye
		temp = new cv::Mat(EyeExtractor::eyeSize, CV_32FC1);
		Application::Components::eyeExtractor->eyeFloatLeft->copyTo(*temp);

		Utils::SharedImage temp3(new cv::Mat(temp->size(), temp->type()), Utils::releaseImage);
		_calibrationTargetImagesLeftAllFrames.push_back(temp3);
		
		_calibrationTargetPointsAllFrames.push_back(Application::Components::calibrator->getActivePoint());

*/
	}
	
	// Update the left and right estimations
	updateEstimations();
}
コード例 #2
0
void GazeTrackerHistogramFeatures::process() {
    if(_histFeatureExtractor == NULL) {
        _histFeatureExtractor = (HistogramFeatureExtractor*) Application::getComponent("HistogramFeatureExtractor");
    }
    if(_eyeExtractor == NULL) {
        _eyeExtractor = (EyeExtractor*) Application::getComponent("EyeExtractor");
    }
    
	if (!Application::Data::isTrackingSuccessful) {
		return;
	}
    
	// If recalibration is necessary (there is a new target), recalibrate the Gaussian Processes
	if(Application::Components::calibrator->needRecalibration) {
		addExemplar();
	}

	// Combine the current horizontal and vertical features to come up with the final features
	cv::Mat horizontalTransposed = _histFeatureExtractor->horizontalFeatures.t();
	horizontalTransposed.copyTo(_currentSample(cv::Rect(0, 0, 1, HORIZONTAL_BIN_SIZE)));

	_histFeatureExtractor->verticalFeatures.copyTo(_currentSample(cv::Rect(0, HORIZONTAL_BIN_SIZE, 1, VERTICAL_BIN_SIZE)));

	horizontalTransposed = _histFeatureExtractor->horizontalFeaturesLeft.t();
	horizontalTransposed.copyTo(_currentSampleLeft(cv::Rect(0, 0, 1, HORIZONTAL_BIN_SIZE)));

	_histFeatureExtractor->verticalFeaturesLeft.copyTo(_currentSampleLeft(cv::Rect(0, HORIZONTAL_BIN_SIZE, 1, VERTICAL_BIN_SIZE)));

	// If active and there is a usable frame
	if(Application::Components::calibrator->isActive()
		&& Application::Components::calibrator->getPointFrameNo() >= 11
		&& !_eyeExtractor->isBlinking()) {
			// Copy the current histogram feature sample to the corresponding row in the accumulation matrices (currentTargetSamples)
			_currentSample.copyTo(_currentTargetSamples(cv::Rect(_currentTargetSampleCount, 0, 1, FEATURE_DIM)));
			_currentSampleLeft.copyTo(_currentTargetSamplesLeft(cv::Rect(_currentTargetSampleCount, 0, 1, FEATURE_DIM)));

			// Increment the sample counter
			_currentTargetSampleCount++;
	}

	// Update the left and right estimations
	updateEstimations();
}