#ifndef _CV_MANAGER_H
#define _CV_MANAGER_H


#define OF_ADDON_USING_OFXVECTORMATH
#define OF_ADDON_USING_OFXOPENCV

#include "ofMain.h"
#include "ofAddons.h"

// baseGui ????
class cvManager {
	
	public:
	cvManager();
		
	//changing cameras or switching from/to the camera mode
	//requires the app to be restarted - mabe we can change this?
	void setupCamera(int deviceNumber, int width, int height);
	void setupVideo(string videoPath);
	
	//do all our openCV allocation
	//---------------------------		
	void setupCV();
	
	//good for adjusting the color balance, brightness etc
	void openCameraSettings();
	void toggleVideoPlayback();
	void useCamera();
	void useVideo();
	
	void	passInImageToFindCardsIn	(ofImage &imgToLookAt);
	void 	processFrame(int threshold, bool bUseImageNotVideo = false);

	vector <ofxCvBlob> findBlobs( int minSize, int maxSize );
	

	//---------------------------				
	void draw(float x, float y);

	//-------------
	//-------------	
	ofVideoPlayer  	VP;
	ofVideoGrabber 	VG;
	
	ofxCvColorImage			ImageFrame;				// sometimes we will find cards in a passed in image, this is how. 
	ofxCvColorImage			VideoFrame;
	ofxCvGrayscaleImage		GreyFrame;
	ofxCvGrayscaleImage		PresenceFrame;
	ofxCvContourFinder		Contour;
	

		
	bool bCameraSetup, bVideoSetup;
	bool bSetup;	
	int W;
	int H;	
	int which;

};



#endif