// Paths assume this file is in the /src diretory
#include "../include/camera.h"
#include "../include/frame.h"
#include "../include/gui.h"
#include "../include/font.h"

int main(int argc, char** argv) {

	// Set up camera and settings variables
	Camera cam;
	cam.dev = "/dev/video0";
	picParams pic_params;
	camParams cam_params;

	// Start camera and get settings
	if (cam.init()) exit(0);
	pic_params = cam.getPicParams();
	cam_params = cam.getCamParams();
	 
	// Switch to 320x240 at 30FPS
	cam_params.width = 320;
	cam_params.height = 240;
	cam_params.framerate = 30;
	cam.setCamParams(cam_params);
	cam.setPicParams(pic_params);

	// Create a frame buffer for the camera
	Frame* f;
	f = new Frame(cam_params);

	// Set up gui
	GUI gui;	
	gui.init();
	gui.setDisplayMode(MODE_640x480x24);

	// Image processing loop
	while (1) {

		// Take a picture
		cam.capture(f);
	
		// Draw original frame
		gui.drawFrame(f, 0, 0);
	
		// Run image processing algorithm
		f->convertToHSV();
	
		// Draw new frame to the right
		gui.drawFrame(f, 320, 0);

		// Show the display buffer
		gui.showScreen();	
	
	}
	return -1;
}
