Example #1
0
//Handle event; return 0 if ignored, else 1
int GameStart::eventHandler(Event *p_e) {

	LevelHandler &levelhandler = LevelHandler::getInstance();
	GameManager &game_manager = GameManager::getInstance();
	//Keyboard
	if (levelhandler.getLevel() != 1) {
		return 0;
	}
	if (p_e->getType() == KEYBOARD_EVENT) {
		EventKeyboard *p_keyboard_event = (EventKeyboard *) p_e;
		switch (p_keyboard_event->getKey()) {
		case 'p':	//Play
			showInstructions(false); // change to start screen for when the player quits
			start();
			break;
		case 'q':	//Quit
			game_manager.setGameOver();
			break;
		case 'i':   // Show instructions
			showInstructions(!showInstruct);
			break;
		case '1':	//Checkpoint 1
			if (levelhandler.getCheckpoint() > 0) {
				levelhandler.nextLevel(6);
			}
			break;
		case '2':	//Checkpoint 2
			if (levelhandler.getCheckpoint() > 1) {
				levelhandler.nextLevel(7);
			}
			break;
		case '3':	//Checkpoint 3
			if (levelhandler.getCheckpoint() > 2) {
				levelhandler.nextLevel(9);
			}
			break;
		case '4':	//Checkpoint 4
			if (levelhandler.getCheckpoint() > 3) {
				levelhandler.nextLevel(10);
			}
			break;
		case '5':	//Checkpoint 5
			if (levelhandler.getCheckpoint() > 4) {
				levelhandler.nextLevel(11);
			}
			break;
		default:
			break;
		}
		return 1;
	}

	//If we get here, we have ignored this event
	return 0;

}
int BaconDemo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QFrame::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: scoreChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: levelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: start(); break;
        case 3: pause(); break;
        case 4: showInstructions(); break;
        }
        _id -= 5;
    }
    return _id;
}
Example #3
0
int main()
{
    float betAmount, money;
    int value, random, action;
        // do while loop so user can keep playing
do {
    showInstructions();
    betAmount = getBetAmount();
    value = makeBet();
    random = spinWheel();
    money = figureWinnings(value, random, betAmount);
    printf("\nYou won $%.2f", money);
    printf("\nDo you want to play another game?\nPress o to quit or 1 to continue. ");
    scanf("%d",&action);
}while (action != 0);

    return 0;
}
// on "init" you need to initialize your instance
bool PizzaSpeedLevel::init()
{
    // 1. super init first
    if ( !Layer::init() )  return false;

    createStarsBackground("Pictures/bigStar.png",20);
    createStarsBackground("Pictures/smallStar.png",50);

    showInstructions();
    createMenu();
    addRemainingTimeLabel();
    addBackground("Pictures/PizzaSpeedBack.png");
    addSpaceShip("Pictures/PizzaSpeedShip.png");
    addTimeSlider();

    schedule( schedule_selector( PizzaSpeedLevel::update) );
    schedule( schedule_selector(PizzaSpeedLevel::updateRemainingTime));

    return true;
}
MainWindow::MainWindow(QWidget *parent)
	: QMainWindow(parent)
{
	QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
	setMinimumSize(450, 480);
	
	newGameMenu = menuBar()->addMenu("New game");
	optionsMenu = menuBar()->addMenu("Options");
	helpMenu = menuBar()->addMenu("Help");

	easyGame = new QAction("Easy", this);
	newGameMenu->addAction(easyGame);
	connect(easyGame, SIGNAL(triggered()), this, SLOT(generateEasy()));
	easyGame->setShortcut(Qt::CTRL + Qt::Key_1);
	
	mediumGame = new QAction("Medium", this);
	newGameMenu->addAction(mediumGame);
	connect(mediumGame, SIGNAL(triggered()), this, SLOT(generateMedium()));
	mediumGame->setShortcut(Qt::CTRL + Qt::Key_2);
	
	hardGame = new QAction("Hard", this);
	newGameMenu->addAction(hardGame);
	connect(hardGame, SIGNAL(triggered()), this, SLOT(generateHard()));
	hardGame->setShortcut(Qt::CTRL + Qt::Key_3);
	
	/*randomGame = new QAction("Random", this);
	newGameMenu->addAction(randomGame);
	connect(randomGame, SIGNAL(triggered()), this, SLOT(generateRandom()));
	randomGame->setShortcut(Qt::CTRL + Qt::Key_4);*/

	solve = new QAction("Solve", this);
	optionsMenu->addAction(solve);
	connect(solve, SIGNAL(triggered()), this, SLOT(showSolution()));
	solve->setShortcut(Qt::CTRL + Qt::Key_F);
	
	stopSolving = new QAction("Stop solving", this);
	optionsMenu->addAction(stopSolving);
	connect(stopSolving, SIGNAL(triggered()), this, SLOT(solvingStopped()));
	stopSolving->setShortcut(Qt::CTRL + Qt::Key_R);
	
	previousMove = new QAction("Move back", this);
	optionsMenu->addAction(previousMove);
	connect(previousMove, SIGNAL(triggered()), this, SLOT(moveBack()));
	previousMove->setShortcut(Qt::CTRL + Qt::Key_Z);
	
	nextMove = new QAction("Move forward", this);
	optionsMenu->addAction(nextMove);
	connect(nextMove, SIGNAL(triggered()), this, SLOT(moveForward()));
	nextMove->setShortcut(Qt::CTRL + Qt::Key_Y);
	
	getInfo = new QAction("Instructions", this);
	helpMenu->addAction(getInfo);
	connect(getInfo, SIGNAL(triggered()), this, SLOT(showInstructions()));
	getInfo->setShortcut(Qt::Key_F1);

	gview = new Graphics();
	setCentralWidget(gview);

	scene = new QGraphicsScene();
	scene->setBackgroundBrush(QColor("#e0e0e0"));

	gview->setScene(scene);
	gview->setEnabled(true);

	counter = new QLabel();
	
	for (int i = 1; i <= 15; i++)
		tiles[i] = NULL;
	
	srand(time(NULL));
	gameBoard = NULL;
	
	generateEasy();

	statusBar()->addWidget(counter);

	timer = new QTimer(this);
	timer->setInterval(400);
	connect(timer, SIGNAL(timeout()), this, SLOT(moveForward()));
}
Example #6
0
int main()
{
    // Initialize globals
    initGlobals();

    // Window
    window.setSize(sf::Vector2u(window_width, window_height));
    window.setPosition(sf::Vector2i(200, 200));
    window.setFramerateLimit(FRAMES_PER_SECOND);
    //window.setVerticalSyncEnabled(true);
    window.setKeyRepeatEnabled(false);

    // Camera view
    sf::View windowView;

    // Menu
    initializeMenu();

    // UI
    ui.init();

    // Minimap
//    Minimap minimap;

    // Create & Set contactlistener
    BoxContactListener boxContactListener;
    physicsWorld.SetContactListener(&boxContactListener);

    // Build world
    //gameWorld.generateWorld(physicsWorld);

    // ------------------------------- MAIN LOOP -------------------------------
    while(window.isOpen())
    {
        // ------------------------------- Input & Views -------------------------------
        sf::Event event;
        gameEvents.processEvents(window, event);

        // Update view in case of window resize
        window_width = window.getSize().x;
        window_height = window.getSize().y;
        windowView.setSize(window_width, window_height);

//        if(minimap.updateViewThroughMinimap)
//        {
//            windowView.setCenter(minimap.newViewCenter.x, minimap.newViewCenter.y);
//        }

        if(player.hasNewFocus)
        {
            windowView.setCenter(player.getNewFocus().x, player.getNewFocus().y);
        }

        // Update normal view with inputs
        windowView = updateView(windowView);

        if(gameWorld.completionStarted && gameWorld.completionTimer.timeReached())
        {
            windowView.setCenter(window_width/2, window_height/2);
            global_levelComplete = false;
        }

        // Clear window
        window.clear(sf::Color(255, 255, 255, 255));

        if(global_isMenu)
        {
            ui.setSize(window_width, window_height);
            window.setView(ui.getView());

            menu_logo_bottom->setPosition(window_width - textures["menu_logo_bottom"].getSize().x, window_height - textures["menu_logo_bottom"].getSize().y);

            menu.update(gameEvents);
            menu.draw(window);

            // Instructions
            if(show_instructions)
            {
                showInstructions();

                if(show_instructions_controls)
                {
                    showControls();
                }

                if(show_instructions_gameplay)
                {
                    showGameplay();
                }
            }
        }
        else
        {
            window.setView(windowView);

            // ------------------------------- Updates -------------------------------

            // Player
            player.update(physicsWorld, gameEvents, gameWorld);

            if(!global_isPaused)
            {
                // Physics
                physicsWorld.Step(TIME_STEP, VELOCITY_ITERATIONS, POSITION_ITERATIONS);

                // World
                gameWorld.update(gameEvents, physicsWorld, player);

                // UI
                ui.update(gameWorld, player);
            }


            // Calculate viewable area
            int viewShiftX = window.getSize().x/2 - window.getView().getCenter().x;
            int viewShiftY = window.getSize().y/2 - window.getView().getCenter().y;
            int windowMinX = -100 - viewShiftX;
            int windowMaxX = windowMinX + window_width + 200;
            int windowMinY = -100 - viewShiftY;
            int windowMaxY = windowMinY + window_height + 200;

            // ------------------------------- Drawing -------------------------------

            window.setView(ui.getView());
            // Background
            sf::Vertex rectangle[] =
            {
                sf::Vertex(sf::Vector2f(0.0f, 0.0f), sf::Color(0, 100, 130, 255)),
                sf::Vertex(sf::Vector2f(window_width, 0.0f), sf::Color(0, 100,130, 255)),
                sf::Vertex(sf::Vector2f(window_width, window_height), sf::Color(0, 200, 230, 255)),
                sf::Vertex(sf::Vector2f(0.0f, window_height), sf::Color(0, 200, 230, 255))
            };
            window.draw(rectangle, 4, sf::Quads);

            window.setView(windowView);

            // World & Player
            gameWorld.draw(window, b2Vec2(windowMinX, windowMinY), b2Vec2(windowMaxX, windowMaxY), false);
            player.draw(window);

            // HUD !!CLASS!!
            ui.setSize(window_width, window_height);
            window.setView(ui.getView());

            if(!gameWorld.completionTimer.timeReached() && gameWorld.completionStarted)
            {
                sf::Text temp("You have won", font_default, 40);

                int midX = window_width / 2.0f - 100;
                int midY = window_height / 2.0f - 40;

                temp.setPosition(midX, midY);
                temp.setColor(sf::Color::White);

                window.draw(temp);
            }

            if(global_isPaused)
            {
                sf::RectangleShape rect;
                rect.setSize(sf::Vector2f(window_width, window_height));
                rect.setPosition(0,0);
                rect.setFillColor(sf::Color(100, 100, 100, 155));

                window.draw(rect);
            }

            ui.draw(window);


    //        sf::RectangleShape border;
    //        border.setPosition(0.0f, window_height - (window_height*minimapSize + MINIMAP_BORDER_SIZE));
    //        border.setSize(sf::Vector2f(window_width*minimapSize + MINIMAP_BORDER_SIZE, window_height*minimapSize + MINIMAP_BORDER_SIZE));
    //        border.setFillColor(sf::Color(0, 0, 200, 255));
    //
    //        window.draw(border);
    //
    //        // ------------------------------- Minimap -------------------------------
    //
    //        minimap.setSize(MAX_WORLD_WIDTH * BOX_SIZE, MAX_WORLD_WIDTH * BOX_SIZE, window_width, window_height);
    //        minimap.calcViewport(minimapSize);
    //        minimap.setCameraPosition(windowView.getCenter().x, windowView.getCenter().y);
    //        window.setView(minimap.getUpdatedView());
    //
    //        minimap.update(gameEvents);
    //
    //        minimap.draw(window);
    //        gameWorld.draw(window, b2Vec2(-10000, -20000), b2Vec2(10000, 10000), true);
    //        player.draw(window);
    //        minimap.drawCameraWindow(window);

            // Default View again
            window.setView(windowView);
        }

        // Display
        window.display();
    }

    return 0;
}
Example #7
0
void Oubliette::showEvent(QShowEvent *ev)
{
    QWidget::showEvent(ev);
    QTimer::singleShot(0, this, SLOT(showInstructions()));
}
Example #8
0
/***************************************************  Main  ***********************************************/
int main(int argc, char** argv)
{

	
	if(argc<=1){
		//cout << "Input image was not loaded, please verify: " << argv[1] << endl;
		showInstructions();
		return -1;
	}
	
	int c = atoi(argv[1]);
	cv::Mat templ, ori, result;
	string img1_file, img2_file , inpoints1, inpoints2,outpoints1,outpoints2,input3dtriangles, result_image;
	
	switch ( c ) {
	case 0: 
		break;
	case 1: {
		if(argc<5){
			cout << "Application usage is not correct, please refer to usage" << endl;
			showInstructions();
			return -1;
		}
 		
 		
 		img1_file = argv[2];
 		img2_file = argv[3];
 		outpoints1 = argv[4];
 		outpoints2 = argv[5];
 		//Read image files
 		ori = imread(img1_file,1);
 		templ = imread(img2_file,1);
 		testTriangleWrite(ori,templ,1,0.5,outpoints1,outpoints2);
 		
 		cout << "Load Points successfully written in files: " << outpoints1 << " and " << outpoints2 << endl;
 		return 1;
 		
 		}
	case 2:
	{
	
		if(argc<8){
			cout << "Application usage is not correct, please refer to usage" << endl;
			showInstructions();
			return -1;
		}
		img1_file = argv[2];
 		img2_file = argv[3];
 		input3dtriangles = argv[4];
 		inpoints1 = argv[5];
 		inpoints2 = argv[6];
 		int img_number = atoi(argv[7]);
 		result_image = argv[8];
 		
 		//Read image files
 		ori = imread(img1_file,1);
 		templ = imread(img2_file,1);
 		
 		//Test reading and interpolating image
 		result = testTriangleRead(ori, templ, 1, 0.5, input3dtriangles, inpoints1,inpoints2, img_number, result_image );
		
		//Save image
		//imwrite(result_image,result);
		cout<< "Load image interpolated and saved in file: " << result_image << endl;
		return 1;
	}
	
	case 3:
	{
		if(argc<4){
			cout << "Application usage is not correct, please refer to usage" << endl;
			showInstructions();
			return -1;
		}
		img1_file = argv[2];
		input3dtriangles = argv[3];
		result_image = argv[4];
		
		//Read image files
 		ori = imread(img1_file,1);
 		
 		result = testMultipleTrianglePerspective(ori,input3dtriangles);
 		
 		imwrite(result_image,result);
 		cout << "Load 3 successfully reconstructed image from input triangles" << endl;
 		return 1;
	}
	
	case 4: 
	{
	
		if(argc<5){
			cout << "Application usage is not correct, please refer to usage" << endl;
			showInstructions();
			return -1;
		}
		img1_file = argv[2];
 		img2_file = argv[3];
 		int nb_inter = atoi(argv[4]);
 		string folder = argv[5];
 		
 		//Read image files
 		ori = imread(img1_file,1);
 		templ = imread(img2_file,1);
 		
 		multipleInterpolateTest(ori,templ,nb_inter,folder);
 		return 1;
	
	}
	
	case 5: 
	{
	
		if(argc<3){
			cout << "Application usage is not correct, please refer to usage" << endl;
			showInstructions();
			return -1;
		}
		img1_file = argv[2];
 		string folder = argv[3];
 		
 		//Read image files
 		ori = imread(img1_file,1);
 		
 		if(!ori.data){
 			cout << "Please choose correct image. Error loading image file" << endl;
 			return -1;
 		}
 		getCubeFacesTest(ori,folder);
 		return 1;
	
	}
 	 
	default:
	  showInstructions();
 	  return -1;
	}
	

	//setupImageAndClouds(name,)
	/********************************* Define parameters ***************************************/
	//Define the constants that we will be using. 
	// - radius is the desired radius of the sphere
	// - phi0 and phi1 represent min and max values of angle phi [0,2PI]
	// - theta0 and theta1 represent min and max values of angle theta [0,PI]
	// alpha the rotation angel between successive images


	//Math variables, point coordinates and angles
	double theta,phi,x,y,z;

	//b,g,r color values of input image
	float b,g,r;

	//empty color vector
	cv::Vec3f color(0.0,0.0,0.0);
	cv::Vec3b colorOri;


	//Pcl point cloud for sphere
	PointCloud<PointXYZRGB>::Ptr cloud (new PointCloud<PointXYZRGB>);
	PointCloud<PointXYZRGB>::Ptr sight (new PointCloud<PointXYZRGB>);
	PointCloud<PointXYZRGB>::Ptr sightFlat (new PointCloud<PointXYZRGB>);
	PointXYZRGB iPoint;
	PointXYZRGB vPoint;
	PointXYZRGB u;
	PointXYZRGB v;

	//Sphere Centers are all defined in the XY plane because we do not rotate outside that plane
	double xc,zc;
	double yc = 0;



	//Setup 3D visualizer
	//visualization::PCLVisualizer viewer("3D viewer");
	//	visualization::CloudViewer cViewer ("Simple Cloud Viewer");
	//	//viewer.setBackgroundColor (0, 0, 0);



	//String names for line
	ostringstream line;

	// Vectors for mats and pointClouds
	vector<cv::Mat> allImages(nb_images);
	vector<PointCloud<PointXYZRGB>::Ptr> allPtClouds(nb_images);
	vector<PointCloud<PointXYZRGB>::Ptr> CTBPtClouds(3);
	vector<PointCloud<PointXYZRGB>::Ptr> allVtClouds(nb_images);

	// cv::Mat for original and spherical image
	//cv::Mat ori,top,bottom;

	//Number of lines to draw
	int nbLines = 1000000;
	int lnCount = 0;
	/*********************************************** end Define parameters *************************************************/


	//Loading images
	//cv::Mat ori1, ori2, ori3;



	//Load first image to get size and data
	//int im_num = 0;
	//loadImagei(name,im_num+1,ori);

	//Verify image has content
	//if(!ori.data){
	//	cout << "Input image was not loaded, please verify: " << argv[1] << im_num + 1 <<".jpg" << endl;
	//	return -1;
	//}


	//allImages[im_num] = ori;
	//sphereCenter(alpha, im_num, dist_c, xc, zc);
	//cout << "xc: "<< xc << endl;
	//cloud = EquiToSphere(ori, radius,xc,yc,zc);


	//allPtClouds[im_num] = cloud;
	//im_num++;
	//recover cv::Mat props
	//cv::Size s = ori.size();
	//int rows = s.height;
	//int cols = s.width;
	//cvResizeWindow("Original",rows,cols);
	//cvNamedWindow("Keypoints 2D",0);
	//imshow("Original",ori);
	//cvNamedWindow("Original",0);
	//cvNamedWindow("SightMat",0);

	//For testing
	//cv::Mat sph = cv::Mat::zeros(rows, cols, CV_8UC3);
	//end for testing

	//loadImagei(name,3,ori2);
	//loadImagei(name,4,ori3);


	/**************************************************** End of Initiate ************************************************/	

	//For testing in order not to load all images every time
	//int tempCount =atoi(argv[2]);
	//cout << "Images to be loaded: " << tempCount<< endl;

	//for(int k=im_num; k<tempCount; k++){
		//cout << "k: " << k << endl;
		//loadImagei(name,k+1,ori);
		//allImages[k] = ori;
		//cout << "width: " << allImages[k].cols << endl;
		//cout << "Height: " << allImages[k].rows << endl;
		//Verify image has content
		//if(!ori.data){
		//	cout << "Input image was not loaded, please verify: " << argv[1] << k+1 <<".jpg" << endl;
		//	return -1;
		//}

		//Get the center of the Kth sphere in World Coordinates
		//sphereCenter(alpha, k, dist_c, xc, zc);

		//Create Sphere from Equirectangular image and store in Point Cloud
		//yc=0;
		//cloud = EquiToSphere(ori, radius,xc,yc,zc);
		//allPtClouds[k] = cloud;	

		//Save the PCD files
		//ostringstream file;
		//file << "./theta_pcds/" ;
		//cloud->width = cols;
		//cloud->height = rows;
		//cloud->points.resize(cols*rows);
		//cloud->is_dense = true;
		//file << name <<k << ".pcd"; 
		//String s = file.str();
		//io::savePCDFileASCII(s,*cloud);	

	//}//End of K loop of image

	//If Top and Bottom given
	//	string tb = argv[3];
	//	if(tb==""){
	//		//Load top and bottom Images
	//		loadImageTop(name,top,"top");
	//		xc = 0;		
	//		yc = dist_c;
	//		zc = 0;
	//		cloud = EquiToSphere(top, radius,xc,yc,zc);
	//		
	//		loadImageTop(name,bottom,"bottom");
	//		xc = 0;		
	//		yc = -dist_c;
	//		zc = 0;
	//		cloud = EquiToSphere(top, radius,xc,yc,zc);
	//		
	//	}

	//t1 = clock() - t;
	//cout << "Time to execute firs part before Kmean: " << (float)t1/CLOCKS_PER_SEC <<endl;

	/******************************* Test Zone ******************************************************/
	//=====================Testing space variables==================================//
	//cloud = allPtClouds[0];
	//ori = allImages[0];

	int nbPoints = 10;
	vector<PointXYZRGB> points;
	int m = 0;
	PointXYZRGB ikm;	
	PointXYZRGB o;
	//set o to origin
	o.x = 0;
	o.y = 0;
	o.z = 0;


	//Set u to anywhere in the sphere and v any direction
	u.x = 0;
	u.y = 0;
	u.z = 0;;
	v.x = 0;
	v.y = 1;
	v.z = 0;



	double step = 2*radius/nbPoints;
	iPoint.x = 0;
	iPoint.z = 0;
	iPoint.b = 255;
	v.r = 255;
	ikm.g = 255;
	vector<PointXYZRGB> linep(50);


	



	//Test of get plane function and project to Sphere with this plane
	//getPlaneAndProjectToSphere(PointXYZRGB u, PointXYZRGB v, PointCloud<PointXYZRGB>::Ptr sight)



	//Test of projection with Angle from 1 point
	//	projectionWithAngleFromOnePointTest(1,radius);



/////////////////////////////// end Test of viewing angle origin //////////////////////////////////
	//viewingAngleOriginTest( u,  v, radius,  rows, cols,cloud, sightFlat);
	//int trows = round(2048*70/360);
	//int tcols = round(1024*57/180);
	//sph = imageFromPcPlane(sightFlat,allImages[0],trows, tcols);
	//cv::imshow("SightMat" , sph);
//	cv::waitKey(0);
	//Viewing angles
///////////////////////////////////////  Test point on ray ////////////////////////////////////////
	//	iPoint.x = 0;
	//	iPoint.y = 0;
	//	iPoint.z = 0;
	//	
	//	o.r = o.g = o.b = 255;
	//	sight->points.push_back(u);
	//	//cout << "Ipoint on Ray: " << isOnRay(o,u,v) << endl;
	//	//cout << "Ipoint on Ray: " << isCloseToRayCube(o,u,v,0) << endl;
	//	
	//	//for all the pt clouds converted
	//	
	//	for(int m=0;m<tempCount;m++){
	//		//Get the sphere center of projection
	//		sphereCenter(alpha, m, dist_c, xc, zc);
	//		o.x = xc;
	//		o.z = zc;
	//		cloud = allPtClouds[m];
	//		for(int n=0;n<cloud->size();n++){
	//			iPoint = cloud->points[n];
	//		

	//			if(isCloseToRayCube(u,o,iPoint,.9)){
	//				sightFlat->points.push_back(iPoint);
	//				//cout << "ray passing through u: " << iPoint << endl;
	//			}
	//		}
	//	
		//cout << "Number of points: " << sightFlat->size() << endl;
	//	}
	//	
	//	//for Top and Bottom
//////////////////////////////////////  end Test point on ray ////////////////////////////////////


	//Test of 2D keypoints and Matches
	//KeyPointAndMatchesTest(allImages[0], allImages[1]);
	
	//Test of image interpolation
	ori = cv::imread("Bottom/Bottom3.jpg",1);

	
	templ = cv::imread("Bottom/Bottom4.jpg",1);

//	interpolate2DTest(allImages[0], allImages[1], 8, 4);
	
	//Test of sphereInterpolate
	//sightFlat = sphereInterpolate(allImages[0], allImages[1], 8, 4);
	
//	//Test of optical flow 
	//optFlowMapTest(ori, templ);
	
	//Line detection testing
	//getLinesTest(ori);
	
//	edge detection test
//	cv::Mat result1 = detectEdges(ori);
//	cv::Mat result2 = detectEdges(templ);
//	cv::namedWindow("edges1", 0);
//	cv::namedWindow("edges2", 0);
//	cv::imshow("edges1", result1);
//	cv::imshow("edges2", result2);
	
	
	//cv::Mat inter = cv::Mat::ones(ori.rows/2, ori.cols/2, ori.type());
	//cv::resize(ori,inter,inter.size(),0,0,INTER_CUBIC);
	//cv::pyrDown(ori,inter,Size(ori.cols/2,ori.rows/2));
	//ori = inter;
	
	//cv::pyrDown(templ,inter,Size(ori.cols/2,ori.rows/2));
	//cv::Mat inter2 = cv::Mat::ones(ori.rows/2, ori.cols/2, ori.type());
	//cv::resize(templ,inter2,inter.size(),0,0,INTER_CUBIC);
	//templ = inter2;

	
	//Test of Delaunay Triangles
	//delaunayTriangleTest(ori, "T1");
	//delaunayTriangleTestBound(ori, "T1");
	//delaunayTriangleTest(allImages[1], "T2");
	
	//Test with Maching
	//delaunayMatchedTrianglesTest(ori, templ,sightFlat);
	//delaunayMatchedTrianglesBoundTest(ori, templ,sightFlat);
	
	//Test delaunay interpolation
	double nb_inter = 50;
	int i=0;
	//vector<cv::Mat> interpolated = delaunayInterpolateMultiple(ori,templ,1,nb_inter);
	
	
	//Multi image vector for test
	vector<cv::Mat> images;
	
	//Test of multiple interpolated images 
	//multipleInterpolateTest(ori,templ,2);	
	

	//Test of reading files from folder and making video
	//Read and write files from tmp
	//for(i=0;i<nb_inter;i++){
	//	ostringstream nameWindow;
	//	nameWindow << "temp/Interpolated Image_"<< i << ".jpg" ;
		//nameWindow << "Bottom/Bottom"<< i+1 << ".jpg" ;
	//	Mat image = cv::imread(nameWindow.str(),1);
	//	if(!image.data){
	//		cout << "Please verify image names" << endl;
	//		break;
	//	}
	//	else{
	//		images.push_back(image);
	//	}
	//}
	//string videoName = "temp/Interpolated Video" ;
	//imageListToVideo(images,videoName);
//	sightFlat = EquiToSphere(result, 1,0,0,0);
	
	
	
	
	//EquiTrans Test 
	//EquitransTest(ori,90.,0.);

	
	//3D Keypoints Test
//	PointCloud<PointWithScale>::Ptr sightFlat1;
//	threeDKeypointsTest(cloud,sightFlat1);
//	PointWithScale pws;
//	PointXYZRGB pxy;
	//cout << "OutCloud size: " << sightFlat1->size() << endl;
//	for(int m=0;m<sightFlat1->size();m++){
//		pws = sightFlat1->points[m];
//		pxy.x = pws.x;
//		pxy.y =  pws.y;
//		pxy.z = pws.z;
//		sightFlat->points.push_back(pxy);
//	}

 	//twoDToThreeDkeypoints(ori);
 	//testCloudObj(allPtClouds[0]);
 	
 	//test3DTriangulation(allPtClouds[0]);
 	
 	//Test writting 3D points
 	//delaunayInterpolateCubeMakeTriangles(ori,templ,1,0.5,"Txt_files/Points3D_test3_1.txt","Txt_files/Points3D_test4_1.txt");
 	//testTriangleWrite(ori,templ,1,0.5,"Txt_files/Zenkoji5_6.txt","Txt_files/Zenkoji6.txt");
 	//Testing reading
 	//testTriangleRead(ori, templ, 1, 0.5, "Txt_files/trianglesZenkoji4_5.txt", "Txt_files/Zenkoji4_5.txt","Txt_files/Zenkoji5.txt", 48);
 	
 	
 	
 	//ori = cv::imread("../Tests/TestResultsNikko/Originals/Nikko (33).JPG",1);
	//templ = cv::imread("../Tests/TestResultsNikko/Originals/Nikko (34).JPG",1);
 	//testTriangleRead(ori, templ, 1, 0.5, "Txt_files/trianglesZenkoji4_5.txt", "Txt_files/Zenkoji4_5.txt","Txt_files/Zenkoji5.txt", 48, "TestResultsZenk/InterPersp4_5_");
 	
 	
 	//testTrianglePerspective(templ);
 	//cloud = EquiToSphere(ori,1,0,0,0);
 	//testTriangleContent3D(ori, cloud,sightFlat);
 	
 	//testSingleTrianglePerspective(ori,templ,1,0.5);
 	//testMultipleTrianglePerspective(ori,"Txt_files/trianglesPoints3D_test3_1.txt");
///////////////////////End of 3D keypoints test ////////////////////////////

	
	//Test of 3D affine
	//ThreeDAffineTransformTest();
	
	
	
	//testKeypointConversion(ori,templ);
	
	//Make video from images
	//string folder = "";
	//imageListToVideo("TestResultsZenk/Equi4_5", "InterpolatedOmni", 48,"TestResultsZenk/Equi4_5/InterpolatedVideo");
	
	
	//Test 2 images video
	//vector<cv::Mat> images;
	//for(int i=0;i<24;i++){
	//	images.push_back(ori);
	//}
	//for(int i=24;i<48;i++){
	//	images.push_back(templ);
	//}
	//imageListToVideo(images,"TestResultsZenk/Originals5_6/NonInterpolatedVideo");
	
	//testImageDiff(ori,templ);
	//randomTest(ori,templ);

	ori = imread("../Tests/TestRotation/Right/Right (14).JPG",1);
	//templ = imread("../Tests/TestRotation/Right/Right (30).JPG",1);
	
	//rotateImageTest("../Tests/TestRotation/Inside", "Test", 48, 270, "../Tests/TestRotation/RotatedChurchRight/Right");
	templ = rotateImagey(ori,20);
	//testImageDiff(ori,templ,"diffImage");
	imwrite("../Tests/TestRotation/Right/Right (14)_rotated-1.JPG", templ);
	
	/******************************************* End of Test Zone ***************************************************************/


	//cvResizeWindow("Keypoints 2D",rows,cols);



	//	cViewer.showCloud (allPtClouds[0]);
	//	cViewer.showCloud (sightFlat);
	//cViewer.showCloud(sightFlat);
	//viewer.addPointCloud(sightFlat, "Sphere");

	//	viewer.addPointCloud(cloud, "Sphere");
	//viewer.addPointCloud(sight, "Sphere1");

	//viewer.addPointCloud(allPtClouds[0], "Sphere");
	//	viewer.addPointCloud(allPtClouds[1], "Sphere1");
		//viewer.addPointCloud(allPtClouds[2], "Sphere2");
	//	viewer.addPointCloud(allPtClouds[3], "Sphere3");
	//imshow("Original",allImages[0]);

	//viewer.addCoordinateSystem (radius*2);
	//viewer.setPointCloudRenderingProperties (visualization::PCL_VISUALIZER_POINT_SIZE, 1, "Sphere");
	//viewer.registerKeyboardCallback (keyboardEventOccurred, (void*)&viewer);
	//while (!viewer.wasStopped ()){
		// This seems to cause trouble when having cloud viewer and viewr running
		//cv::imshow("Keypoints 2D" , sightMat);
	//	viewer.spinOnce (100);

		//cv::waitKey(0);
//		boost::this_thread::sleep (boost::posix_time::microseconds (10000));
	//}

	//close viewer



	
	cv::waitKey(0);



	return 0;
}