diff options
Diffstat (limited to 'ftnoir_tracker_pt')
| -rw-r--r-- | ftnoir_tracker_pt/resources/cap_front.png | bin | 0 -> 1164 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/resources/cap_side.png | bin | 0 -> 1733 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/resources/clip_front.png | bin | 0 -> 571 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/resources/clip_side.png | bin | 0 -> 2677 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/resources/icon.ico | bin | 0 -> 4286 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/resources/xxx_logo_ir.png (renamed from ftnoir_tracker_pt/Resources/Logo_IR.png) | bin | 10386 -> 10386 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/videoinput/xxx_videoinput.h (renamed from ftnoir_tracker_pt/videoInput/videoInput.h) | 770 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/videoinput/xxx_videoinput_vc8.lib (renamed from ftnoir_tracker_pt/videoInput/videoInput_vc8.lib) | bin | 2145206 -> 2145206 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/videoinput/xxx_videoinput_vc9.lib (renamed from ftnoir_tracker_pt/videoInput/videoInput_vc9.lib) | bin | 2119546 -> 2119546 bytes | |||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_camera.cpp (renamed from ftnoir_tracker_pt/camera.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_camera.h (renamed from ftnoir_tracker_pt/camera.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_pt_controls.ui (renamed from ftnoir_tracker_pt/FTNoIR_PT_Controls.ui) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.cpp (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.h (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.qrc (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt.qrc) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.rc (renamed from ftnoir_tracker_pt/FTNoIR_Tracker_PT.rc) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dialog.cpp (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dialog.h (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dll.cpp (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dll.h (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_settings.cpp (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_settings.h (renamed from ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_point_extractor.cpp (renamed from ftnoir_tracker_pt/point_extractor.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_point_extractor.h (renamed from ftnoir_tracker_pt/point_extractor.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_point_tracker.cpp (renamed from ftnoir_tracker_pt/point_tracker.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_point_tracker.h (renamed from ftnoir_tracker_pt/point_tracker.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_resource.h (renamed from ftnoir_tracker_pt/resource.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_timer.cpp (renamed from ftnoir_tracker_pt/timer.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_timer.h (renamed from ftnoir_tracker_pt/timer.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_trans_calib.cpp (renamed from ftnoir_tracker_pt/trans_calib.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_trans_calib.h (renamed from ftnoir_tracker_pt/trans_calib.h) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_video_widget.cpp (renamed from ftnoir_tracker_pt/video_widget.cpp) | 0 | ||||
| -rw-r--r-- | ftnoir_tracker_pt/xxx_video_widget.h (renamed from ftnoir_tracker_pt/video_widget.h) | 0 | 
33 files changed, 385 insertions, 385 deletions
| diff --git a/ftnoir_tracker_pt/resources/cap_front.png b/ftnoir_tracker_pt/resources/cap_front.pngBinary files differ new file mode 100644 index 00000000..14207a67 --- /dev/null +++ b/ftnoir_tracker_pt/resources/cap_front.png diff --git a/ftnoir_tracker_pt/resources/cap_side.png b/ftnoir_tracker_pt/resources/cap_side.pngBinary files differ new file mode 100644 index 00000000..5ad4ee65 --- /dev/null +++ b/ftnoir_tracker_pt/resources/cap_side.png diff --git a/ftnoir_tracker_pt/resources/clip_front.png b/ftnoir_tracker_pt/resources/clip_front.pngBinary files differ new file mode 100644 index 00000000..04880138 --- /dev/null +++ b/ftnoir_tracker_pt/resources/clip_front.png diff --git a/ftnoir_tracker_pt/resources/clip_side.png b/ftnoir_tracker_pt/resources/clip_side.pngBinary files differ new file mode 100644 index 00000000..72667ac7 --- /dev/null +++ b/ftnoir_tracker_pt/resources/clip_side.png diff --git a/ftnoir_tracker_pt/resources/icon.ico b/ftnoir_tracker_pt/resources/icon.icoBinary files differ new file mode 100644 index 00000000..c4b2aedc --- /dev/null +++ b/ftnoir_tracker_pt/resources/icon.ico diff --git a/ftnoir_tracker_pt/Resources/Logo_IR.png b/ftnoir_tracker_pt/resources/xxx_logo_ir.pngBinary files differ index 95032a25..95032a25 100644 --- a/ftnoir_tracker_pt/Resources/Logo_IR.png +++ b/ftnoir_tracker_pt/resources/xxx_logo_ir.png diff --git a/ftnoir_tracker_pt/videoInput/videoInput.h b/ftnoir_tracker_pt/videoinput/xxx_videoinput.h index 4244902c..02841418 100644 --- a/ftnoir_tracker_pt/videoInput/videoInput.h +++ b/ftnoir_tracker_pt/videoinput/xxx_videoinput.h @@ -1,385 +1,385 @@ -#ifndef _VIDEOINPUT
 -#define _VIDEOINPUT
 -
 -//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 -//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 -//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 -//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 -//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 -//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 -//THE SOFTWARE.
 -
 -//////////////////////////////////////////////////////////
 -//Written by Theodore Watson - theo.watson@gmail.com    //
 -//Do whatever you want with this code but if you find   //
 -//a bug or make an improvement I would love to know!    //
 -//														//
 -//Warning This code is experimental 					//
 -//use at your own risk :)								//
 -//////////////////////////////////////////////////////////
 -/////////////////////////////////////////////////////////
 -/*                     Shoutouts 
 -
 -Thanks to: 
 -			
 -		   Dillip Kumar Kara for crossbar code.
 -		   Zachary Lieberman for getting me into this stuff
 -		   and for being so generous with time and code.
 -		   The guys at Potion Design for helping me with VC++
 -		   Josh Fisher for being a serious C++ nerd :)
 -		   Golan Levin for helping me debug the strangest 
 -		   and slowest bug in the world!
 -		   
 -		   And all the people using this library who send in 
 -		   bugs, suggestions and improvements who keep me working on 
 -		   the next version - yeah thanks a lot ;)
 -		   
 -*/
 -/////////////////////////////////////////////////////////
 -
 -
 -
 -#include <stdlib.h>
 -#include <stdio.h>
 -#include <math.h>
 -#include <string.h>
 -#include <wchar.h>
 -
 -//this is for TryEnterCriticalSection
 -#ifndef _WIN32_WINNT
 -	#   define _WIN32_WINNT 0x400
 -#endif
 -#include <windows.h>
 -
 -
 -//Example Usage
 -/*
 -	//create a videoInput object
 -	videoInput VI;
 -	
 -	//Prints out a list of available devices and returns num of devices found
 -	int numDevices = VI.listDevices();	
 -	
 -	int device1 = 0;  //this could be any deviceID that shows up in listDevices
 -	int device2 = 1;  //this could be any deviceID that shows up in listDevices
 -	
 -	//if you want to capture at a different frame rate (default is 30) 
 -	//specify it here, you are not guaranteed to get this fps though.
 -	//VI.setIdealFramerate(dev, 60);	
 -	
 -	//setup the first device - there are a number of options:
 -	
 -	VI.setupDevice(device1); 						  //setup the first device with the default settings
 -	//VI.setupDevice(device1, VI_COMPOSITE); 			  //or setup device with specific connection type
 -	//VI.setupDevice(device1, 320, 240);				  //or setup device with specified video size
 -	//VI.setupDevice(device1, 320, 240, VI_COMPOSITE);  //or setup device with video size and connection type
 -
 -	//VI.setFormat(device1, VI_NTSC_M);					//if your card doesn't remember what format it should be
 -														//call this with the appropriate format listed above
 -														//NOTE: must be called after setupDevice!
 -	
 -	//optionally setup a second (or third, fourth ...) device - same options as above
 -	VI.setupDevice(device2); 						  
 -
 -	//As requested width and height can not always be accomodated
 -	//make sure to check the size once the device is setup
 -
 -	int width 	= VI.getWidth(device1);
 -	int height 	= VI.getHeight(device1);
 -	int size	= VI.getSize(device1);
 -	
 -	unsigned char * yourBuffer1 = new unsigned char[size];
 -	unsigned char * yourBuffer2 = new unsigned char[size];
 -	
 -	//to get the data from the device first check if the data is new
 -	if(VI.isFrameNew(device1)){
 -		VI.getPixels(device1, yourBuffer1, false, false);	//fills pixels as a BGR (for openCV) unsigned char array - no flipping
 -		VI.getPixels(device1, yourBuffer2, true, true); 	//fills pixels as a RGB (for openGL) unsigned char array - flipping!
 -	}
 -	
 -	//same applies to device2 etc
 -	
 -	//to get a settings dialog for the device
 -	VI.showSettingsWindow(device1);
 -	
 -	
 -	//Shut down devices properly
 -	VI.stopDevice(device1);
 -	VI.stopDevice(device2);
 -*/
 -
 -
 -//////////////////////////////////////   VARS AND DEFS   //////////////////////////////////
 -
 -
 -//STUFF YOU CAN CHANGE
 -
 -//change for verbose debug info
 -static bool verbose = true;
 -
 -//if you need VI to use multi threaded com
 -//#define VI_COM_MULTI_THREADED
 -
 -//STUFF YOU DON'T CHANGE
 -
 -//videoInput defines
 -#define VI_VERSION	 0.1995
 -#define VI_MAX_CAMERAS  20
 -#define VI_NUM_TYPES    18 //DON'T TOUCH
 -#define VI_NUM_FORMATS  18 //DON'T TOUCH
 -
 -//defines for setPhyCon - tuner is not as well supported as composite and s-video 
 -#define VI_COMPOSITE 0
 -#define VI_S_VIDEO   1
 -#define VI_TUNER     2
 -#define VI_USB       3
 -#define VI_1394		 4
 -
 -//defines for formats
 -#define VI_NTSC_M	0
 -#define VI_PAL_B	1
 -#define VI_PAL_D	2
 -#define VI_PAL_G	3
 -#define VI_PAL_H	4
 -#define VI_PAL_I	5
 -#define VI_PAL_M	6
 -#define VI_PAL_N	7
 -#define VI_PAL_NC	8
 -#define VI_SECAM_B	9
 -#define VI_SECAM_D	10
 -#define VI_SECAM_G	11
 -#define VI_SECAM_H	12
 -#define VI_SECAM_K	13
 -#define VI_SECAM_K1	14
 -#define VI_SECAM_L	15
 -#define VI_NTSC_M_J	16
 -#define VI_NTSC_433	17
 -
 -
 -//allows us to directShow classes here with the includes in the cpp
 -struct ICaptureGraphBuilder2;
 -struct IGraphBuilder;
 -struct IBaseFilter;
 -struct IAMCrossbar;
 -struct IMediaControl;
 -struct ISampleGrabber;
 -struct IMediaEventEx;
 -struct IAMStreamConfig;
 -struct _AMMediaType;
 -class SampleGrabberCallback;
 -typedef _AMMediaType AM_MEDIA_TYPE;
 -
 -//keeps track of how many instances of VI are being used
 -//don't touch
 -static int comInitCount = 0;
 -
 -
 -////////////////////////////////////////   VIDEO DEVICE   ///////////////////////////////////
 -
 -class videoDevice{
 -
 -	
 -	public:
 -		 
 -		videoDevice();
 -		void setSize(int w, int h);
 -		void NukeDownstream(IBaseFilter *pBF);
 -		void destroyGraph();
 -		~videoDevice();
 -		
 -		int videoSize;
 -		int width;
 -		int height;
 -		int tryWidth;
 -		int tryHeight;
 -		
 -		ICaptureGraphBuilder2 *pCaptureGraph;	// Capture graph builder object
 -		IGraphBuilder *pGraph;					// Graph builder object
 -	    IMediaControl *pControl;				// Media control object
 -		IBaseFilter *pVideoInputFilter;  		// Video Capture filter
 -		IBaseFilter *pGrabberF;
 -		IBaseFilter * pDestFilter;
 -		IAMStreamConfig *streamConf;
 -		ISampleGrabber * pGrabber;    			// Grabs frame
 -		AM_MEDIA_TYPE * pAmMediaType;
 -		
 -		IMediaEventEx * pMediaEvent;
 -		
 -		GUID videoType;
 -		long formatType;
 -		
 -		SampleGrabberCallback * sgCallback;				
 -		
 -		bool tryDiffSize;
 -		bool useCrossbar;
 -		bool readyToCapture;
 -		bool sizeSet;
 -		bool setupStarted;
 -		bool specificFormat;
 -		bool autoReconnect;
 -		int  nFramesForReconnect;
 -		unsigned long nFramesRunning;
 -		int  connection;
 -		int	 storeConn;
 -		int  myID;
 -		long requestedFrameTime; //ie fps
 -		
 -		char 	nDeviceName[255];
 -		WCHAR 	wDeviceName[255];
 -		
 -		unsigned char * pixels;
 -		char * pBuffer;
 -
 -};
 -
 -
 -
 -
 -//////////////////////////////////////   VIDEO INPUT   /////////////////////////////////////
 -
 -
 -
 -class videoInput{
 -
 -	public:
 -		videoInput();
 -		~videoInput();
 -				
 -		//turns off console messages - default is to print messages
 -		static void setVerbose(bool _verbose);
 -		
 -		//Functions in rough order they should be used.
 -		static int listDevices(bool silent = false);
 -
 -		//needs to be called after listDevices - otherwise returns NULL
 -		static char * getDeviceName(int deviceID);
 -		
 -		//choose to use callback based capture - or single threaded
 -		void setUseCallback(bool useCallback);	
 -		
 -		//call before setupDevice
 -		//directshow will try and get the closest possible framerate to what is requested
 -		void setIdealFramerate(int deviceID, int idealFramerate);
 -
 -		//some devices will stop delivering frames after a while - this method gives you the option to try and reconnect
 -		//to a device if videoInput detects that a device has stopped delivering frames. 
 -		//you MUST CALL isFrameNew every app loop for this to have any effect
 -		void setAutoReconnectOnFreeze(int deviceNumber, bool doReconnect, int numMissedFramesBeforeReconnect);
 -		
 -		//Choose one of these four to setup your device
 -		bool setupDevice(int deviceID);
 -		bool setupDevice(int deviceID, int w, int h);
 -
 -		//These two are only for capture cards
 -		//USB and Firewire cameras souldn't specify connection 
 -		bool setupDevice(int deviceID, int connection);	
 -		bool setupDevice(int deviceID, int w, int h, int connection); 
 -		
 -		//If you need to you can set your NTSC/PAL/SECAM
 -		//preference here. if it is available it will be used.
 -		//see #defines above for available formats - eg VI_NTSC_M or VI_PAL_B
 -		//should be called after setupDevice
 -		//can be called multiple times
 -		bool setFormat(int deviceNumber, int format);	
 -				
 -		//Tells you when a new frame has arrived - you should call this if you have specified setAutoReconnectOnFreeze to true
 -		bool isFrameNew(int deviceID); 
 -		
 -		bool isDeviceSetup(int deviceID);
 -		    
 -		//Returns the pixels - flipRedAndBlue toggles RGB/BGR flipping - and you can flip the image too
 -		unsigned char * getPixels(int deviceID, bool flipRedAndBlue = true, bool flipImage = false);
 -		
 -		//Or pass in a buffer for getPixels to fill returns true if successful.
 -		bool getPixels(int id, unsigned char * pixels, bool flipRedAndBlue = true, bool flipImage = false);
 -		
 -		//Launches a pop up settings window
 -		//For some reason in GLUT you have to call it twice each time. 
 -		void showSettingsWindow(int deviceID);
 -		
 -		//Manual control over settings thanks..... 
 -		//These are experimental for now.
 -		bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
 -		bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = NULL);
 -		bool getVideoSettingFilter(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
 -
 -		bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
 -		bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = NULL);
 -		bool getVideoSettingCamera(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue);
 -
 -		//bool setVideoSettingCam(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false);
 -
 -		//get width, height and number of pixels
 -		int  getWidth(int deviceID);
 -		int  getHeight(int deviceID);
 -		int  getSize(int deviceID);
 -		
 -		//completely stops and frees a device
 -		void stopDevice(int deviceID);
 -		
 -		//as above but then sets it up with same settings
 -		bool restartDevice(int deviceID);
 -		
 -		//number of devices available
 -		int  devicesFound;
 -		
 -		long propBrightness;
 -		long propContrast;
 -		long propHue;
 -		long propSaturation;
 -		long propSharpness;
 -		long propGamma;
 -		long propColorEnable;
 -		long propWhiteBalance;
 -		long propBacklightCompensation;
 -		long propGain;
 -
 -		long propPan;
 -		long propTilt;
 -		long propRoll;
 -		long propZoom;
 -		long propExposure;
 -		long propIris;
 -		long propFocus;
 -				
 -		
 -	private:		
 -		void setPhyCon(int deviceID, int conn);                   
 -		void setAttemptCaptureSize(int deviceID, int w, int h);   
 -		bool setup(int deviceID);
 -		void processPixels(unsigned char * src, unsigned char * dst, int width, int height, bool bRGB, bool bFlip);
 -		int  start(int deviceID, videoDevice * VD);                   
 -		int  getDeviceCount();
 -		void getMediaSubtypeAsString(GUID type, char * typeAsString);
 -		
 -		HRESULT getDevice(IBaseFilter **pSrcFilter, int deviceID, WCHAR * wDeviceName, char * nDeviceName);
 -		static HRESULT ShowFilterPropertyPages(IBaseFilter *pFilter);
 -		HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath);
 -		HRESULT routeCrossbar(ICaptureGraphBuilder2 **ppBuild, IBaseFilter **pVidInFilter, int conType, GUID captureMode);
 -			
 -		//don't touch
 -		static bool comInit();
 -		static bool comUnInit();
 -
 -		int  connection;
 -		int  callbackSetCount;
 -		bool bCallback;
 -		
 -		GUID CAPTURE_MODE;
 -		
 -		//Extra video subtypes
 -		GUID MEDIASUBTYPE_Y800;
 -		GUID MEDIASUBTYPE_Y8;
 -		GUID MEDIASUBTYPE_GREY;
 -
 -		videoDevice * VDList[VI_MAX_CAMERAS];
 -		GUID mediaSubtypes[VI_NUM_TYPES];
 -		long formatTypes[VI_NUM_FORMATS];
 -
 -		static void __cdecl basicThread(void * objPtr);
 -
 -		static char deviceNames[VI_MAX_CAMERAS][255];
 -
 -}; 
 -  
 - #endif
 +#ifndef _VIDEOINPUT +#define _VIDEOINPUT + +//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +//THE SOFTWARE. + +////////////////////////////////////////////////////////// +//Written by Theodore Watson - theo.watson@gmail.com    // +//Do whatever you want with this code but if you find   // +//a bug or make an improvement I would love to know!    // +//														// +//Warning This code is experimental 					// +//use at your own risk :)								// +////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////// +/*                     Shoutouts  + +Thanks to:  +			 +		   Dillip Kumar Kara for crossbar code. +		   Zachary Lieberman for getting me into this stuff +		   and for being so generous with time and code. +		   The guys at Potion Design for helping me with VC++ +		   Josh Fisher for being a serious C++ nerd :) +		   Golan Levin for helping me debug the strangest  +		   and slowest bug in the world! +		    +		   And all the people using this library who send in  +		   bugs, suggestions and improvements who keep me working on  +		   the next version - yeah thanks a lot ;) +		    +*/ +///////////////////////////////////////////////////////// + + + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <wchar.h> + +//this is for TryEnterCriticalSection +#ifndef _WIN32_WINNT +	#   define _WIN32_WINNT 0x400 +#endif +#include <windows.h> + + +//Example Usage +/* +	//create a videoInput object +	videoInput VI; +	 +	//Prints out a list of available devices and returns num of devices found +	int numDevices = VI.listDevices();	 +	 +	int device1 = 0;  //this could be any deviceID that shows up in listDevices +	int device2 = 1;  //this could be any deviceID that shows up in listDevices +	 +	//if you want to capture at a different frame rate (default is 30)  +	//specify it here, you are not guaranteed to get this fps though. +	//VI.setIdealFramerate(dev, 60);	 +	 +	//setup the first device - there are a number of options: +	 +	VI.setupDevice(device1); 						  //setup the first device with the default settings +	//VI.setupDevice(device1, VI_COMPOSITE); 			  //or setup device with specific connection type +	//VI.setupDevice(device1, 320, 240);				  //or setup device with specified video size +	//VI.setupDevice(device1, 320, 240, VI_COMPOSITE);  //or setup device with video size and connection type + +	//VI.setFormat(device1, VI_NTSC_M);					//if your card doesn't remember what format it should be +														//call this with the appropriate format listed above +														//NOTE: must be called after setupDevice! +	 +	//optionally setup a second (or third, fourth ...) device - same options as above +	VI.setupDevice(device2); 						   + +	//As requested width and height can not always be accomodated +	//make sure to check the size once the device is setup + +	int width 	= VI.getWidth(device1); +	int height 	= VI.getHeight(device1); +	int size	= VI.getSize(device1); +	 +	unsigned char * yourBuffer1 = new unsigned char[size]; +	unsigned char * yourBuffer2 = new unsigned char[size]; +	 +	//to get the data from the device first check if the data is new +	if(VI.isFrameNew(device1)){ +		VI.getPixels(device1, yourBuffer1, false, false);	//fills pixels as a BGR (for openCV) unsigned char array - no flipping +		VI.getPixels(device1, yourBuffer2, true, true); 	//fills pixels as a RGB (for openGL) unsigned char array - flipping! +	} +	 +	//same applies to device2 etc +	 +	//to get a settings dialog for the device +	VI.showSettingsWindow(device1); +	 +	 +	//Shut down devices properly +	VI.stopDevice(device1); +	VI.stopDevice(device2); +*/ + + +//////////////////////////////////////   VARS AND DEFS   ////////////////////////////////// + + +//STUFF YOU CAN CHANGE + +//change for verbose debug info +static bool verbose = true; + +//if you need VI to use multi threaded com +//#define VI_COM_MULTI_THREADED + +//STUFF YOU DON'T CHANGE + +//videoInput defines +#define VI_VERSION	 0.1995 +#define VI_MAX_CAMERAS  20 +#define VI_NUM_TYPES    18 //DON'T TOUCH +#define VI_NUM_FORMATS  18 //DON'T TOUCH + +//defines for setPhyCon - tuner is not as well supported as composite and s-video  +#define VI_COMPOSITE 0 +#define VI_S_VIDEO   1 +#define VI_TUNER     2 +#define VI_USB       3 +#define VI_1394		 4 + +//defines for formats +#define VI_NTSC_M	0 +#define VI_PAL_B	1 +#define VI_PAL_D	2 +#define VI_PAL_G	3 +#define VI_PAL_H	4 +#define VI_PAL_I	5 +#define VI_PAL_M	6 +#define VI_PAL_N	7 +#define VI_PAL_NC	8 +#define VI_SECAM_B	9 +#define VI_SECAM_D	10 +#define VI_SECAM_G	11 +#define VI_SECAM_H	12 +#define VI_SECAM_K	13 +#define VI_SECAM_K1	14 +#define VI_SECAM_L	15 +#define VI_NTSC_M_J	16 +#define VI_NTSC_433	17 + + +//allows us to directShow classes here with the includes in the cpp +struct ICaptureGraphBuilder2; +struct IGraphBuilder; +struct IBaseFilter; +struct IAMCrossbar; +struct IMediaControl; +struct ISampleGrabber; +struct IMediaEventEx; +struct IAMStreamConfig; +struct _AMMediaType; +class SampleGrabberCallback; +typedef _AMMediaType AM_MEDIA_TYPE; + +//keeps track of how many instances of VI are being used +//don't touch +static int comInitCount = 0; + + +////////////////////////////////////////   VIDEO DEVICE   /////////////////////////////////// + +class videoDevice{ + +	 +	public: +		  +		videoDevice(); +		void setSize(int w, int h); +		void NukeDownstream(IBaseFilter *pBF); +		void destroyGraph(); +		~videoDevice(); +		 +		int videoSize; +		int width; +		int height; +		int tryWidth; +		int tryHeight; +		 +		ICaptureGraphBuilder2 *pCaptureGraph;	// Capture graph builder object +		IGraphBuilder *pGraph;					// Graph builder object +	    IMediaControl *pControl;				// Media control object +		IBaseFilter *pVideoInputFilter;  		// Video Capture filter +		IBaseFilter *pGrabberF; +		IBaseFilter * pDestFilter; +		IAMStreamConfig *streamConf; +		ISampleGrabber * pGrabber;    			// Grabs frame +		AM_MEDIA_TYPE * pAmMediaType; +		 +		IMediaEventEx * pMediaEvent; +		 +		GUID videoType; +		long formatType; +		 +		SampleGrabberCallback * sgCallback;				 +		 +		bool tryDiffSize; +		bool useCrossbar; +		bool readyToCapture; +		bool sizeSet; +		bool setupStarted; +		bool specificFormat; +		bool autoReconnect; +		int  nFramesForReconnect; +		unsigned long nFramesRunning; +		int  connection; +		int	 storeConn; +		int  myID; +		long requestedFrameTime; //ie fps +		 +		char 	nDeviceName[255]; +		WCHAR 	wDeviceName[255]; +		 +		unsigned char * pixels; +		char * pBuffer; + +}; + + + + +//////////////////////////////////////   VIDEO INPUT   ///////////////////////////////////// + + + +class videoInput{ + +	public: +		videoInput(); +		~videoInput(); +				 +		//turns off console messages - default is to print messages +		static void setVerbose(bool _verbose); +		 +		//Functions in rough order they should be used. +		static int listDevices(bool silent = false); + +		//needs to be called after listDevices - otherwise returns NULL +		static char * getDeviceName(int deviceID); +		 +		//choose to use callback based capture - or single threaded +		void setUseCallback(bool useCallback);	 +		 +		//call before setupDevice +		//directshow will try and get the closest possible framerate to what is requested +		void setIdealFramerate(int deviceID, int idealFramerate); + +		//some devices will stop delivering frames after a while - this method gives you the option to try and reconnect +		//to a device if videoInput detects that a device has stopped delivering frames.  +		//you MUST CALL isFrameNew every app loop for this to have any effect +		void setAutoReconnectOnFreeze(int deviceNumber, bool doReconnect, int numMissedFramesBeforeReconnect); +		 +		//Choose one of these four to setup your device +		bool setupDevice(int deviceID); +		bool setupDevice(int deviceID, int w, int h); + +		//These two are only for capture cards +		//USB and Firewire cameras souldn't specify connection  +		bool setupDevice(int deviceID, int connection);	 +		bool setupDevice(int deviceID, int w, int h, int connection);  +		 +		//If you need to you can set your NTSC/PAL/SECAM +		//preference here. if it is available it will be used. +		//see #defines above for available formats - eg VI_NTSC_M or VI_PAL_B +		//should be called after setupDevice +		//can be called multiple times +		bool setFormat(int deviceNumber, int format);	 +				 +		//Tells you when a new frame has arrived - you should call this if you have specified setAutoReconnectOnFreeze to true +		bool isFrameNew(int deviceID);  +		 +		bool isDeviceSetup(int deviceID); +		     +		//Returns the pixels - flipRedAndBlue toggles RGB/BGR flipping - and you can flip the image too +		unsigned char * getPixels(int deviceID, bool flipRedAndBlue = true, bool flipImage = false); +		 +		//Or pass in a buffer for getPixels to fill returns true if successful. +		bool getPixels(int id, unsigned char * pixels, bool flipRedAndBlue = true, bool flipImage = false); +		 +		//Launches a pop up settings window +		//For some reason in GLUT you have to call it twice each time.  +		void showSettingsWindow(int deviceID); +		 +		//Manual control over settings thanks.....  +		//These are experimental for now. +		bool setVideoSettingFilter(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false); +		bool setVideoSettingFilterPct(int deviceID, long Property, float pctValue, long Flags = NULL); +		bool getVideoSettingFilter(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue); + +		bool setVideoSettingCamera(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false); +		bool setVideoSettingCameraPct(int deviceID, long Property, float pctValue, long Flags = NULL); +		bool getVideoSettingCamera(int deviceID, long Property, long &min, long &max, long &SteppingDelta, long ¤tValue, long &flags, long &defaultValue); + +		//bool setVideoSettingCam(int deviceID, long Property, long lValue, long Flags = NULL, bool useDefaultValue = false); + +		//get width, height and number of pixels +		int  getWidth(int deviceID); +		int  getHeight(int deviceID); +		int  getSize(int deviceID); +		 +		//completely stops and frees a device +		void stopDevice(int deviceID); +		 +		//as above but then sets it up with same settings +		bool restartDevice(int deviceID); +		 +		//number of devices available +		int  devicesFound; +		 +		long propBrightness; +		long propContrast; +		long propHue; +		long propSaturation; +		long propSharpness; +		long propGamma; +		long propColorEnable; +		long propWhiteBalance; +		long propBacklightCompensation; +		long propGain; + +		long propPan; +		long propTilt; +		long propRoll; +		long propZoom; +		long propExposure; +		long propIris; +		long propFocus; +				 +		 +	private:		 +		void setPhyCon(int deviceID, int conn);                    +		void setAttemptCaptureSize(int deviceID, int w, int h);    +		bool setup(int deviceID); +		void processPixels(unsigned char * src, unsigned char * dst, int width, int height, bool bRGB, bool bFlip); +		int  start(int deviceID, videoDevice * VD);                    +		int  getDeviceCount(); +		void getMediaSubtypeAsString(GUID type, char * typeAsString); +		 +		HRESULT getDevice(IBaseFilter **pSrcFilter, int deviceID, WCHAR * wDeviceName, char * nDeviceName); +		static HRESULT ShowFilterPropertyPages(IBaseFilter *pFilter); +		HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath); +		HRESULT routeCrossbar(ICaptureGraphBuilder2 **ppBuild, IBaseFilter **pVidInFilter, int conType, GUID captureMode); +			 +		//don't touch +		static bool comInit(); +		static bool comUnInit(); + +		int  connection; +		int  callbackSetCount; +		bool bCallback; +		 +		GUID CAPTURE_MODE; +		 +		//Extra video subtypes +		GUID MEDIASUBTYPE_Y800; +		GUID MEDIASUBTYPE_Y8; +		GUID MEDIASUBTYPE_GREY; + +		videoDevice * VDList[VI_MAX_CAMERAS]; +		GUID mediaSubtypes[VI_NUM_TYPES]; +		long formatTypes[VI_NUM_FORMATS]; + +		static void __cdecl basicThread(void * objPtr); + +		static char deviceNames[VI_MAX_CAMERAS][255]; + +};  +   + #endif diff --git a/ftnoir_tracker_pt/videoInput/videoInput_vc8.lib b/ftnoir_tracker_pt/videoinput/xxx_videoinput_vc8.libBinary files differ index 15ca9cf3..15ca9cf3 100644 --- a/ftnoir_tracker_pt/videoInput/videoInput_vc8.lib +++ b/ftnoir_tracker_pt/videoinput/xxx_videoinput_vc8.lib diff --git a/ftnoir_tracker_pt/videoInput/videoInput_vc9.lib b/ftnoir_tracker_pt/videoinput/xxx_videoinput_vc9.libBinary files differ index 32637cc9..32637cc9 100644 --- a/ftnoir_tracker_pt/videoInput/videoInput_vc9.lib +++ b/ftnoir_tracker_pt/videoinput/xxx_videoinput_vc9.lib diff --git a/ftnoir_tracker_pt/camera.cpp b/ftnoir_tracker_pt/xxx_camera.cpp index fc11c738..fc11c738 100644 --- a/ftnoir_tracker_pt/camera.cpp +++ b/ftnoir_tracker_pt/xxx_camera.cpp diff --git a/ftnoir_tracker_pt/camera.h b/ftnoir_tracker_pt/xxx_camera.h index cd1f0842..cd1f0842 100644 --- a/ftnoir_tracker_pt/camera.h +++ b/ftnoir_tracker_pt/xxx_camera.h diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/xxx_ftnoir_pt_controls.ui index 0174df23..0174df23 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/xxx_ftnoir_pt_controls.ui diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.cpp index 5b77da69..5b77da69 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.cpp diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.h b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.h index 2533a39b..2533a39b 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.h +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.h diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.qrc b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.qrc index eb1fba2c..eb1fba2c 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.qrc +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.qrc diff --git a/ftnoir_tracker_pt/FTNoIR_Tracker_PT.rc b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.rc index 11c5d52f..11c5d52f 100644 --- a/ftnoir_tracker_pt/FTNoIR_Tracker_PT.rc +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt.rc diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dialog.cpp index a1531dd7..a1531dd7 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dialog.cpp diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dialog.h index 0f836dfe..0f836dfe 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.h +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dialog.h diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dll.cpp index 7f58d77d..7f58d77d 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.cpp +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dll.cpp diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dll.h index 15ad63aa..15ad63aa 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dll.h +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_dll.h diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_settings.cpp index 40d1bc4f..40d1bc4f 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.cpp +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_settings.cpp diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_settings.h index 88162c86..88162c86 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/xxx_ftnoir_tracker_pt_settings.h diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/xxx_point_extractor.cpp index 4aa1a658..4aa1a658 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/xxx_point_extractor.cpp diff --git a/ftnoir_tracker_pt/point_extractor.h b/ftnoir_tracker_pt/xxx_point_extractor.h index b142d2bb..b142d2bb 100644 --- a/ftnoir_tracker_pt/point_extractor.h +++ b/ftnoir_tracker_pt/xxx_point_extractor.h diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/xxx_point_tracker.cpp index d617de19..d617de19 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/xxx_point_tracker.cpp diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/xxx_point_tracker.h index 21baad19..21baad19 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/xxx_point_tracker.h diff --git a/ftnoir_tracker_pt/resource.h b/ftnoir_tracker_pt/xxx_resource.h index c14e94ad..c14e94ad 100644 --- a/ftnoir_tracker_pt/resource.h +++ b/ftnoir_tracker_pt/xxx_resource.h diff --git a/ftnoir_tracker_pt/timer.cpp b/ftnoir_tracker_pt/xxx_timer.cpp index 363b5b09..363b5b09 100644 --- a/ftnoir_tracker_pt/timer.cpp +++ b/ftnoir_tracker_pt/xxx_timer.cpp diff --git a/ftnoir_tracker_pt/timer.h b/ftnoir_tracker_pt/xxx_timer.h index 2aaf725a..2aaf725a 100644 --- a/ftnoir_tracker_pt/timer.h +++ b/ftnoir_tracker_pt/xxx_timer.h diff --git a/ftnoir_tracker_pt/trans_calib.cpp b/ftnoir_tracker_pt/xxx_trans_calib.cpp index 9b75a1b6..9b75a1b6 100644 --- a/ftnoir_tracker_pt/trans_calib.cpp +++ b/ftnoir_tracker_pt/xxx_trans_calib.cpp diff --git a/ftnoir_tracker_pt/trans_calib.h b/ftnoir_tracker_pt/xxx_trans_calib.h index 4024d011..4024d011 100644 --- a/ftnoir_tracker_pt/trans_calib.h +++ b/ftnoir_tracker_pt/xxx_trans_calib.h diff --git a/ftnoir_tracker_pt/video_widget.cpp b/ftnoir_tracker_pt/xxx_video_widget.cpp index c2b41da1..c2b41da1 100644 --- a/ftnoir_tracker_pt/video_widget.cpp +++ b/ftnoir_tracker_pt/xxx_video_widget.cpp diff --git a/ftnoir_tracker_pt/video_widget.h b/ftnoir_tracker_pt/xxx_video_widget.h index f49fef18..f49fef18 100644 --- a/ftnoir_tracker_pt/video_widget.h +++ b/ftnoir_tracker_pt/xxx_video_widget.h | 
