Community Core Vision 1.4
Cross platform, user friendly computer vision.
C:/CCV/1.4/addons/ofxNCore/src/Filters/Filters.h
Go to the documentation of this file.
00001 /*
00002 *  Filters.h
00003 *  
00004 *
00005 *  Created on 2/2/09.
00006 *  Copyright 2009 NUI Group. All rights reserved.
00007 *
00008 */
00009 
00010 #ifndef FILTERS_H_
00011 #define FILTERS_H_
00012 
00013 #include "ofMain.h"
00014 #include "ofxOpenCv.h"
00015 #include "CPUImageFilter.h"
00016 #include "GPUImageFilter.h"
00017 
00018 #define CAMERA_EXPOSURE_TIME  2200.0f
00019 
00020 class Filters {
00021   
00022         public:
00023 
00024           Filters(){
00025 
00026                 camWidth = 320;
00027                 camHeight = 240;
00028                 exposureStartTime = CAMERA_EXPOSURE_TIME;
00029 
00030                 //filter values
00031                 threshold = 120;
00032                 smooth = 0;
00033                 highpassBlur = 0;
00034                 highpassNoise = 0;
00035                 highpassAmp = 0;
00036                 fLearnRate = 1;
00037           }
00038 
00039     int camWidth;
00040     int camHeight;
00041     int exposureStartTime;
00042 
00043     //filter values
00044         int threshold;
00045     int smooth;
00046     int highpassBlur;
00047     int highpassNoise;
00048     int highpassAmp;
00049 
00050     float fLearnRate;// rate to learn background
00051 
00052     //filter bools
00053         bool bLearnBackground;
00054         bool bVerticalMirror;
00055         bool bHorizontalMirror;
00056         bool bDynamicBG;
00057         bool bSmooth;
00058         bool bHighpass;
00059         bool bAmplify;
00060     bool bThreshold;
00061         bool bTrackDark;
00062     bool bLearnBakground;
00063         bool bMiniMode;
00064 
00065     //CPU
00066     ofxCvGrayscaleImage grayImg;
00067     ofxCvGrayscaleImage grayBg;
00068     ofxCvGrayscaleImage subtractBg;
00069     ofxCvGrayscaleImage grayDiff;
00070     ofxCvGrayscaleImage highpassImg;
00071     ofxCvGrayscaleImage ampImg;
00072         ofxCvShortImage         floatBgImg;
00073 
00074 
00075     //GPU
00076     GLuint                      gpuBGTex;
00077     GLuint                      gpuSourceTex;
00078     ofxCvGrayscaleImage gpuReadBackImageGS;
00079         unsigned char  * gpuReadBackBuffer;
00080     GPUImageFilter * contrastFilter;
00081     GPUImageFilter * subtractFilter;
00082     GPUImageFilter * subtractFilter2; //we need 2 because we are showing the output of each
00083     GPUImageFilter * gaussVFilter;
00084     GPUImageFilter * gaussVFilter2;
00085     GPUImageFilter * gaussHFilter;
00086     GPUImageFilter * gaussHFilter2;
00087     GPUImageFilter * threshFilter;
00088     GPUImageFilter * copyFilter;
00089     GPUImageFilter * grayScale;
00090 
00091     virtual void allocate( int w, int h ) = 0;
00092     virtual void applyCPUFilters(CPUImageFilter& img) = 0;
00093     virtual void draw() = 0;
00094 
00095     virtual void allocateGPU() = 0;
00096     virtual void applyGPUFilters() = 0;
00097     virtual void drawGPU() = 0;
00098 };
00099 
00100 
00101 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines