Example #1
0
void createDecisionTree()
{
	myTree.CreateTree(generatedPoints);
}
Example #2
0
void specialKeyboard(int key, int x, int y)
{
	if (key == GLUT_KEY_F1)
	{
		fullscreen = !fullscreen;

		if (fullscreen)
			glutFullScreen();
		else
		{
			glutReshapeWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT);
			glutPositionWindow(50, 50);
		}
	}
	if (key == GLUT_KEY_F2)
	{
		//createDecisionTree();
		clock_t start = clock();
		PixelList* p = createPixelList();
		cout << "Time to create pixel list: " << ((clock() - start) / (float)CLOCKS_PER_SEC) << endl;
		cout << "PixelList size: " << p->size() << endl;

		if(!p->isEmpty())
		{
			time_t start,end;
			time (&start);
			//FeatureDefinition myBestFit = myTree.MaximizeInfoGain(*p);
			myTree.CreateTree(p);
			time (&end);
			double dif = difftime (end,start);
			//cout << "Time to MaximizeInfoGain: " << dif << " seconds" << endl;

			//cout << "Defined feature > ";
			//cout << "Radius = " << myBestFit.radius << ", angle = " <<  myBestFit.angle << ", ratio = " <<  myBestFit.ratio << endl;
		}
		else
		{
			cout << "Error creating PixelList!";
		}
	}

	if (key == GLUT_KEY_F12)
	{
		cout << "Opening Image" << endl;
		png::image<png::rgb_pixel> img("/home/igormacedo/Blender/images/color0.png");

		rgb_pixel pixel = img[119][159];
		cout << "RED:" << (int)pixel.red << " GREEN:" << (int)pixel.green << " BLUE:" << (int) pixel.blue << endl;

		img.read("/home/igormacedo/Blender/images/color12.png");
		pixel = img[60][60];
		cout << "RED:" << (int)pixel.red << " GREEN:" << (int)pixel.green << " BLUE:" << (int) pixel.blue << endl;

	}

	if(key == GLUT_KEY_F3)
	{

	}

	if(key == GLUT_KEY_F4)
	{
		evaluateImage();
	}
}