Exemplo n.º 1
0
void GazeTracker::load() {
	CvFileStorage *in = cvOpenFileStorage("calibration.xml", NULL, CV_STORAGE_READ);
	CvFileNode *root = cvGetRootFileNode(in);
	load(in, cvGetFileNodeByName(in, root, "GazeTracker"));
	cvReleaseFileStorage(&in);
	updateGaussianProcesses();
}
Exemplo n.º 2
0
void GazeTracker::addExemplar(Point point, const cv::Mat *eyeFloat, const cv::Mat *eyeGrey) {
	_calTargets.push_back(CalTarget(point, eyeFloat, eyeGrey));
	updateGaussianProcesses();
}
void GazeTrackerHistogramFeatures::addExemplar() {
	
	//ARCADI addExemplar
	
	int sizeVectorOfVectors = vectorOfVectors_horizontal.size();

    for (int i = sizeVectorOfVectors-1; i > Application::Components::calibrator->getPointNumber(); i--) {

        int sizeVector = vectorOfVectors_horizontal.operator[](i).size();

        for (int j = 0; j < sizeVector; j++) {

            vectorOfVectors_horizontal.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) += vectorOfVectors_horizontal.operator[](i).operator[](j);
            vectorOfVectors_horizontal_left.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) += vectorOfVectors_horizontal_left.operator[](i).operator[](j);
            
        }

        sizeVector = vectorOfVectors_vertical.operator[](i).size();

        for (int j = 0; j < sizeVector; j++) {

            vectorOfVectors_vertical.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) += vectorOfVectors_vertical.operator[](i).operator[](j);
            vectorOfVectors_vertical_left.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) += vectorOfVectors_vertical_left.operator[](i).operator[](j);
            
        }

        vectorOfVectors_horizontal.pop_back();
        vectorOfVectors_vertical.pop_back();
        vectorOfVectors_horizontal_left.pop_back();
        vectorOfVectors_vertical_left.pop_back();

    }
    std::cout << "Calibrator process() for 2" << std::endl;

    for (int j = 0; j < vectorOfVectors_horizontal.operator[](Application::Components::calibrator->getPointNumber()).size(); j++) {

        vectorOfVectors_horizontal.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) = floor(vectorOfVectors_horizontal.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) / (sizeVectorOfVectors - Application::Components::calibrator->getPointNumber()));
        vectorOfVectors_horizontal_left.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) = floor(vectorOfVectors_horizontal_left.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) / (sizeVectorOfVectors - Application::Components::calibrator->getPointNumber()));
    }

    std::cout << "Calibrator process() for 3" << std::endl;
    for (int j = 0; j < vectorOfVectors_vertical.operator[](Application::Components::calibrator->getPointNumber()).size(); j++) {

        vectorOfVectors_vertical.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) = floor(vectorOfVectors_vertical.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) / (sizeVectorOfVectors - Application::Components::calibrator->getPointNumber()));
        vectorOfVectors_vertical_left.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) = floor(vectorOfVectors_vertical_left.operator[](Application::Components::calibrator->getPointNumber()).operator[](j) / (sizeVectorOfVectors - Application::Components::calibrator->getPointNumber()));
    
    }

    std::cout << "Calibrator process() resto" << std::endl;
    std::vector<std::vector<int> > AUX_POSITION_VECTOR;

    std::cout << "Calibrator process() resto 2" << std::endl;
    
	Application::Components::eyeSegmentation->SortHistogram(&(vectorOfVectors_horizontal.operator[](Application::Components::calibrator->getPointNumber())), &(vectorOfVectors_vertical.operator[](Application::Components::calibrator->getPointNumber())), &AUX_POSITION_VECTOR);

    std::cout << "Calibrator process() resto 3" << std::endl;
    histPositionSegmentedPixels.push_back(AUX_POSITION_VECTOR);

    std::cout << "Calibrator process() resto 4" << std::endl;
    std::vector<std::vector<int> > AUX_POSITION_VECTOR_LEFT;

    std::cout << "Calibrator process() resto 5" << std::endl;
	Application::Components::eyeSegmentation->SortHistogram(&(vectorOfVectors_horizontal_left.operator[](Application::Components::calibrator->getPointNumber())), &(vectorOfVectors_vertical_left.operator[](Application::Components::calibrator->getPointNumber())), &AUX_POSITION_VECTOR_LEFT);

    std::cout << "Calibrator process() resto 6" << std::endl;
    histPositionSegmentedPixels_left.push_back(AUX_POSITION_VECTOR_LEFT);
	
	//ARCADI addExemplar


/*
	// Add new sample to the GPs. Save the image samples (average eye images) in corresponding vectors
	_calibrationTargetHistogramFeatures.push_back(Application::Components::eyeExtractor->averageEye->getMean());
	_calibrationTargetHistogramFeaturesLeft.push_back(Application::Components::eyeExtractor->averageEyeLeft->getMean());
*/
	updateGaussianProcesses();
}