void CalibrationUtils::nextCalibrationStep() { if(bCalibrating) { calibrationStep++; if(calibrationStep >= GRID_POINTS) { bCalibrating = false; calibrationStep = 0; saveCalibration(); calculateBox(); // computeCameraToScreenMap(); saveCalibration(); } } }
void calibrationB::nextCalibrationStep() { if(bCalibrating) { calibrationStep++; if(calibrationStep >= GRID_POINTS) { printf("Calibration complete\n"); bCalibrating = false; calibrationStep = 0; saveCalibration(); calculateBox(); computeCameraToScreenMap(); } } }
//! Chargement des paramètres de calibration depuis le fichier "config.xml" void CalibrationUtils::loadXMLSettings(){ bGoToNextStep = false; // Can this load via http? if( calibrationXML.loadFile("calibration.xml")){ //WOOT! message = "Calibration Loaded!"; }else{ //FAIL! message = "No calibration Found..."; // GENERATE DEFAULT XML DATA WHICH WILL BE SAVED INTO THE CONFIG } bool bboxRoot = true; bool screenRoot = true; bCalibrating = false; calibrationStep = 0; //Set grid and init everything that relates to teh grid GRID_X = calibrationXML.getValue("SCREEN:GRIDMESH:GRIDX", 50); GRID_Y = calibrationXML.getValue("SCREEN:GRIDMESH:GRIDY", 50); //setGrid(GRID_X, GRID_Y); setGrid(GRID_X, GRID_Y); //Bounding Box Points if(bboxRoot){ vector2df ul(calibrationXML.getValue("SCREEN:BOUNDINGBOX:ulx", 0.000000),calibrationXML.getValue("SCREEN:BOUNDINGBOX:uly", 0.000000)); vector2df lr(calibrationXML.getValue("SCREEN:BOUNDINGBOX:lrx", 1.000000),calibrationXML.getValue("SCREEN:BOUNDINGBOX:lry", 1.000000)); rect2df boundingbox(ul, lr); setScreenBBox(boundingbox); }else{ setScreenScale(1.0f); } //Calibration Points if(screenRoot) { //lets see how many <STROKE> </STROKE> tags there are in the xml file int numDragTags = calibrationXML.getNumTags("SCREEN:POINT"); //if there is at least one <POINT> tag we can read the list of points if(numDragTags > 0){ //we push into the last POINT tag this temporarirly treats the tag as the document root. calibrationXML.pushTag("SCREEN:POINT", numDragTags-1); //we see how many points we have stored in <POINT> tags int numPtTags = calibrationXML.getNumTags("POINT"); if(numPtTags > 0){ //We then read those x y values into our array for(int i = 0; i < numPtTags; i++){ //the last argument of getValue can be used to specify //which tag out of multiple tags you are refering to. int x = calibrationXML.getValue("POINT:X", 0.000000, i); int y = calibrationXML.getValue("POINT:Y", 0.000000, i); cameraPoints[i].coord = vector2df(x,y); printf("Calibration: %f, %f\n", cameraPoints[i].coord.X, cameraPoints[i].coord.Y); bscreenPoints = true; bcameraPoints = true; } } calibrationXML.popTag(); //Set XML root back to highest level } } //End calibrationXML Calibration Settings //Set the camera calibated box. calculateBox(); computeCameraToScreenMap(); }