Exemplo n.º 1
0
void SpirographApp::setup()
{
	mLoc = Vec2f(getWindowWidth()/2, getWindowHeight()/2);
	
	mSpirograph = new SpirographPoint();
	
	// Base Spirograph parameters
	mAngle = 0.0f;
	mRadius = 65.0f;
	
	mIncAngle = 0.02f;
	
	
	// Setup the parameters
	mParams = params::InterfaceGl("Spirograph Parameters", Vec2i(100, 200));
	
	mParams.addParam("Angle", &mAngle);
	mParams.addParam("Increment Angle", &mIncAngle);
	mParams.addParam("Radius", &mRadius);
	mParams.addSeparator();
	mParams.addParam("Spirograph Angle", &mSpirograph->mAngle);
	mParams.addParam("Spirograph Radius", &mSpirograph->mRadius);
	
	
	mSaveFrames = false;
	
	
	// Opengl blending
	glEnable(GL_BLEND);
	
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	
	glEnable(GL_POLYGON_SMOOTH);
	glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); // GL_FASTEST	
}
void SierpinskiTriangleChaos3DApp::setup()
{
    
    // SETUP CAMERA
	mCameraDistance = 1000.0f;
	mEye			= Vec3f( 0.0f, 300.0f, mCameraDistance );
	mCenter			= Vec3f( 0.0f, 300.0f, 0.0f );
	mUp				= Vec3f::yAxis();
	mCam.setPerspective( 75.0f, getWindowAspectRatio(), 5.0f, 3000.0f );
    
    
    //PARAMS
    mParams = params::InterfaceGl( "Control Panel", Vec2i( 200, 160 ) );
    mParams.addParam( "Scene Rotation", &mSceneRotation );
    mParams.addParam( "Eye Distance", &mCameraDistance, "min=50.0 max=1300.0 step=20.0 keyIncr=s keyDecr=w" );
    
    glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
	
	gl::enableDepthWrite();
	gl::enableDepthRead();
	gl::enableAlphaBlending();
    
    glDisable( GL_TEXTURE_2D );
    
    mDirectional = 1.0f;
    
    marker1.set( 0.0f, 0.0f, 400.0f);
    marker2.set( -346.5f, 0.0f, -200.0f);
    marker3.set( 346.5f, 0.0f, -200.0f);
    marker4.set( 0.0f, 600.0f, 0.0f);
    
    thePoint.set( Rand::randFloat(-100.0f, 100.0f), Rand::randFloat(-100.0f, 100.0f), Rand::randFloat(-100.0f, 100.0f) );
    
    mSaveFrame = true;
}
void FractalStudyApp::setup()
{
    // SETUP CAMERA
	mCameraDistance = 1200.0f;
	mEye			= Vec3f( 0.0f, 0.0f, mCameraDistance );
	mCenter			= Vec3f( 0.0f, 0.0f, 0.0f );
	mUp				= Vec3f::yAxis();
	mCam.setPerspective( 75.0f, getWindowAspectRatio(), 5.0f, 2000.0f );
    
    
    //PARAMS
    mParams = params::InterfaceGl( "Control Panel", Vec2i( 200, 160 ) );
    mParams.addParam( "Scene Rotation", &mSceneRotation );
    mParams.addParam( "Eye Distance", &mCameraDistance, "min=50.0 max=1500.0 step=50.0 keyIncr=s keyDecr=w" );
    
    glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
	
	gl::enableDepthWrite();
	gl::enableDepthRead();
	gl::enableAlphaBlending();
    
    glDisable( GL_TEXTURE_2D );
    
    mDirectional = 1.0f;
    
    camAngle = 0;
    
    mSaveFrame = false;
}
void ArmyDemoApp::setup()
{

	mSender.bind();
#if ! USE_UDP
	mSender.connect();
#endif

	model::Skeleton::sRenderMode = model::Skeleton::RenderMode::CLEANED;

	mLightPos = vec3(10.0f, 20.0f, 20.0f);
	mMouseHorizontalPos = 0;
	mMeshIndex = 0;
	mParams = params::InterfaceGl( "Parameters", ivec2( 200, 250 ) );
	mParams.addParam( "Fps", &mFps, "", true );
	mParams.addSeparator();
	mDrawMesh = true;
	mParams.addParam( "Draw Mesh", &mDrawMesh );
	mDrawSkeleton = false;
	mParams.addParam( "Draw Skeleton", &mDrawSkeleton );
	mDrawAbsolute = true;
	mParams.addParam( "Relative/Abolute skeleton", &mDrawAbsolute );
	mEnableWireframe = false;
	mParams.addParam( "Wireframe", &mEnableWireframe );
	
	gl::enableDepthWrite();
	gl::enableDepthRead();
	gl::enableAlphaBlending();
	
	mSkeletalMesh = model::SkeletalMesh::create( model::AssimpLoader( loadAsset( "maggot3.md5mesh" ) ) );
}
Exemplo n.º 5
0
void kinectSkelApp::setup()
{
	console() << "There are " << Kinect::getNumDevices() << " Kinects connected." << std::endl;

	mKinect = Kinect( Kinect::Device() ); // the default Device implies the first Kinect connected
	
	mParams = params::InterfaceGl( "KinectSkel", Vec2i( 200, 180 ) );
	mParams.addParam( "Kinect Tilt", &mKinectTilt, "min=-31 max=31 keyIncr=T keyDecr=t" );
	mParams.addParam( "lo thresh", &mLo, "min=.0 max=1.0 step=.025 keyIncr=L keyDecr=l" );
	mParams.addParam( "hi thresh", &mHi, "min=.0 max=1.0 step=.025 keyIncr=H keyDecr=h" );
	mParams.addParam( "dilate size", &mDilateSize, "min=3 max=20 step=1 keyIncr=D keyDecr=d" );
	mParams.addParam( "dilate iter", &mDilateIter, "min=1 max=10 step=1 keyIncr=F keyDecr=f" );
	mParams.addParam( "skel thresh", &mSkelThresh, "min=0 max=255 step=1 keyIncr=S keyDecr=s" );
	mLo = 0.5;
	mHi = 1.0;
	mDilateSize = 8;
	mDilateIter = 1;
	mKinectTilt = .0f;
	mSkelThresh = 0;
	mFboThresh = gl::Fbo(640, 480);
	mShader	= gl::GlslProg( loadResource( RES_VERT_ID ), loadResource( RES_FRAG_ID ) );
	mDepthTexture	= gl::Texture( 640, 480 );
	mColorTexture	= gl::Texture( 640, 480 );
	depthSurf = Surface8u(640, 480, true);
	
	kern00 = cv::Mat(5, 5, CV_32FC1, L0);
	kern45 = cv::Mat(5, 5, CV_32FC1, L45);
	kern90 = cv::Mat(5, 5, CV_32FC1, L90);
	kern135 = cv::Mat(5, 5, CV_32FC1, L135);
}
void ___PACKAGENAMEASIDENTIFIER___App::setup()
{
	try {
		mCapture = Capture( kCaptureWidth, kCaptureHeight );
		mCapture.start();
	} catch ( ... ) {
		console() << "Error with capture device." << std::endl;
		exit(1);
	}

	try {
		mShader = gl::GlslProg( loadResource( RES_SHADER_PASSTHRU ), loadResource( RES_SHADER_FRAGMENT ) );
	} catch ( gl::GlslProgCompileExc &exc ) {
		console() << "Cannot compile shader: " << exc.what() << std::endl;
		exit(1);
	}catch ( Exception &exc ){
		console() << "Cannot load shader: " << exc.what() << std::endl;
		exit(1);
	}
	
	mFbo = gl::Fbo( kWindowWidth, kWindowHeight );

	mMixColorRed = 0.0f;
	mMixColorGreen = 0.0f;
	mMixColorBlue = 0.0f;

	mParams = params::InterfaceGl( "Parameters", Vec2i( kParamsWidth, kParamsHeight ) );
	mParams.addParam( "Mix Red", &mMixColorRed, "min=-1.0 max=1.0 step=0.01 keyIncr=r keyDecr=R" );
	mParams.addParam( "Mix Green", &mMixColorGreen, "min=-1.0 max=1.0 step=0.01 keyIncr=g keyDecr=G" );
	mParams.addParam( "Mix Blue", &mMixColorBlue, "min=-1.0 max=1.0 step=0.01 keyIncr=b keyDecr=B" );


}
void CinderProjectionTestApp::setup()
{
	mLookEye = Vec3f( 5.0f, 10.0f, 30.0f );
	mSweetEye = Vec3f( 0.0f, 0.0f, 4.0f );
	mProjEye = Vec3f( 2.0f, 3.0f, 3.0f );
	mLookCenter = mSweetCenter = mProjCenter = Vec3f::zero();
	mLookUp = mSweetUp = mProjUp = Vec3f::yAxis();
	
	mLookDistance = 30.0f;
	// setPerspective of cams moved to ::resize()
	
	mActiveCam = CAM_LOOK;
	
	mCubeSize = 1.0f;
	
	mTexture = gl::Texture( loadImage( loadResource( RES_IMAGE ) ) );
    mProjShader = gl::GlslProg( loadResource( RES_TEXTUREPROJECTION_VERT ), loadResource( RES_TEXTUREPROJECTION_FRAG ) );
	mTextureScaling = 1.0f;
	
	vector<string> camEnum;
	camEnum.push_back("Look around (free)");
	camEnum.push_back("'Sweet spot' (fixed)");
	camEnum.push_back("Projector (fixed)");
	
	mParams = params::InterfaceGl( "Texture Projection", Vec2i( 160, 100 ) );
	//mParams.addParam( "Active Cam", camEnum, &mActiveCam ); // ::addParam(..enum..) is not available in Cinder 0.8.2
	//mParams.setOptions("", "iconified=true" ); // ::setOptions is not available in Cinder 0.8.2
	//mParams.setOptions("", "help='Keys [1], [2] and [3] can be used to switch camrea positions'" );
	mParams.addParam( "Avg. FPS", &mFPS, "precision=1", true );
	mParams.addParam( "Tex Scale", &mTextureScaling, "step=0.1" );
	mParams.addParam( "Cube Rot.", &mCubeRotation );
	mParams.addParam( "Cube Size", &mCubeSize, "keyincr=+ keydecr=-" );
	mParams.addSeparator();
	mParams.addParam( "Sweet Eye", &mSweetEye );
}
Exemplo n.º 8
0
void RDiffusionApp::setup()
{
	mReactionU = 0.25f;
	mReactionV = 0.04f;
	mReactionK = 0.047f;
	mReactionF = 0.1f;

	mMousePressed = false;
	
	// Setup the parameters
	mParams = params::InterfaceGl( "Parameters", Vec2i( 175, 100 ) );
	mParams.addParam( "Reaction u", &mReactionU, "min=0.0 max=0.4 step=0.01 keyIncr=u keyDecr=U" );
	mParams.addParam( "Reaction v", &mReactionV, "min=0.0 max=0.4 step=0.01 keyIncr=v keyDecr=V" );
	mParams.addParam( "Reaction k", &mReactionK, "min=0.0 max=1.0 step=0.001 keyIncr=k keyDecr=K" );	
	mParams.addParam( "Reaction f", &mReactionF, "min=0.0 max=1.0 step=0.001 keyIncr=f keyDecr=F" );
	
	gl::Fbo::Format format;
	format.enableDepthBuffer( false );
	
	mCurrentFBO = 0;
	mOtherFBO = 1;
	mFBOs[0] = gl::Fbo( FBO_WIDTH, FBO_HEIGHT, format );
	mFBOs[1] = gl::Fbo( FBO_WIDTH, FBO_HEIGHT, format );
	
	mShader = gl::GlslProg( loadResource( RES_PASS_THRU_VERT ), loadResource( RES_GSRD_FRAG ) );
	mTexture = gl::Texture( loadImage( loadResource( RES_STARTER_IMAGE ) ) );
	mTexture.setWrap( GL_REPEAT, GL_REPEAT );
	mTexture.setMinFilter( GL_LINEAR );
	mTexture.setMagFilter( GL_LINEAR );
	mTexture.bind( 1 );
	
	resetFBOs();
}
Exemplo n.º 9
0
void KaleidoscopeApp::setup()
{
    mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 300 ) );
    mParams.addParam( "Fps", &mFps, "", true );
    mParams.addParam( "Vertical sync", &mVerticalSyncEnabled );
    mParams.addSeparator();
    mNumReflectionLines = 3;
    mParams.addParam( "Reflection lines", &mNumReflectionLines, "min=0, max=32" );
    mRotation = 0.f;
    mParams.addParam( "Rotation", &mRotation, "step=.01" );
    mCenter = Vec2f( .5f, .5f );
    mParams.addParam( "Center X", &mCenter.x, "min=0 max=1 step=.005 group='Center'" );
    mParams.addParam( "Center Y", &mCenter.y, "min=0 max=1 step=.005 group='Center'" );

    mTexture = loadImage( loadAsset( "tx.jpg" ) );
    mTexture.setWrap( true, true );

    try
    {
        mShader = gl::GlslProg( loadAsset( "Kaleidoscope.vert" ),
                                loadAsset( "Kaleidoscope.frag" ) );
    }
    catch ( gl::GlslProgCompileExc &exc )
    {
        console() << exc.what() << endl;
    }
}
Exemplo n.º 10
0
void ColorTilesApp::setup()
{
    app::setWindowSize(1200, 800);
    gl::enableAlphaBlending();

    // Set up the camera.
    cameraDistance_ = 1000.0f;
    eye_ = Vec3f(0.0f, 0.0f, cameraDistance_);
    center_ = Vec3f::zero();
    up_ = Vec3f::yAxis();
    camera_.setPerspective(75.0f, getWindowAspectRatio(), 5.0f, 2000.0f);

    // Set up camera control.
    params_ = params::InterfaceGl("Color Tiles", Vec2i(225, 200));
    params_.addParam("Scene Rotation", &sceneRotation_);
    params_.addParam("Eye Distance", &cameraDistance_, "min=0.0 max=2000.0 step=50.0 keyIncr=s keyDecr=w");
    
    // Set up the initial set of tiles.
    for (int x = -HALF_WIDTH; x <= HALF_WIDTH; ++x) {
        for (int y = -HALF_WIDTH; y <= HALF_WIDTH; ++y) {
            for (int z = -HALF_WIDTH; z <= HALF_WIDTH; ++z) {
                int xpos = x * TILE_WIDTH;
                int ypos = y * TILE_HEIGHT;
                int zpos = z * TILE_WIDTH;
                
                Tile* tile = new Tile(xpos, ypos, zpos,
                                      TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH);
                tiles_.push_back(tile);
            }
        }
    }
}
void SmilesApp::setup()
{	
    mSmileLimit = 4.0f;
    mSmileAverageNumOfFrames = 10;
    mCamIndex = 0;
    mFps = getAverageFps();
    
    try {
		mCapture = Capture( CAMWIDTH, CAMHEIGHT );
		mCapture.start();
	}
	catch( ... ) {
		console() << "Failed to initialize capture" << std::endl;
	}
    
    mSmileRect = Rectf(300,100,600,400);
    setupSmileDetector(mSmileRect.getInteriorArea().getWidth(), mSmileRect.getInteriorArea().getHeight());
    console()<< mSmileRect.getInteriorArea().getWidth() << mSmileRect.getInteriorArea().getHeight() << endl;
	mSmileThreshold = 0;
	mSmileAverageIndex = 0;
    
    mParams = params::InterfaceGl( "Parameters", Vec2i( 220, 170 ) );
    mParams.addParam( "FPS", &mFps,"", true );
    mParams.addSeparator();
	mParams.addParam( "SmileResponse", &mSmileResponse, "", true );
    mParams.addParam( "SmileThreshold", &mSmileThreshold, "", true );
    
    mParams.addParam( "mSmileLimit", &mSmileLimit );
    mParams.addParam( "mSmileAverageNumOfFrames", &mSmileAverageNumOfFrames );
    
}
Exemplo n.º 12
0
void NIUserMaskApp::setup()
{
	try
	{
		mNI = ni::OpenNI( ni::OpenNI::Device() );
	}
	catch ( ... )
	{
		console() << "Could not open Kinect" << endl;
		quit();
	}

	mNIUserTracker = mNI.getUserTracker();

	mNI.setMirrored();
	mNI.start();

	mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 100 ) );
	mBlurAmt = 15.0;
	mParams.addParam( "blur", &mBlurAmt, "min=1 max=15 step=.5" );
	mErodeAmt = 3.0;
	mParams.addParam( "erode", &mErodeAmt, "min=1 max=15 step=.5" );
	mDilateAmt = 7.0;
	mParams.addParam( "dilate", &mDilateAmt, "min=1 max=15 step=.5" );
	mThres = 128;
	mParams.addParam( "threshold", &mThres, "min=1 max=255" );
}
Exemplo n.º 13
0
 KinectDepthSource(params::InterfaceGl& params)
 : mTilt(0)
 , mEnableIR(false)
 {
   params.addParam( "Tilt", &mTilt, "min=-31 max=32");
   params.addParam( "Toggle IR", &mEnableIR);
 }
Exemplo n.º 14
0
void f6_structure::setup()
{
	// SET WINDOW
	setWindowSize(1920, 1080);
	setFrameRate(30.f);
	gl::color(Color::black());

	// SETUP PARTICLE SYSTEMS
	ParticleSystem ps1;
	ps1.setup();
	pss.push_back(ps1);

	// SETUP LISTENER
	Listener& listener = Listener::getInstance();
	listener.setup();

	// SETUP TRACKER
	//t.setup();

	// SETUP PARAMS
	mParams = params::InterfaceGl("Parameters", Vec2i(200, 150));
	mParams.addParam("Particle ID", &pf.d_particleToCreate, "keyIncr=+ keyDecr=-");
	mParams.addSeparator();
	mParams.addParam("Total particles", &mTotalParticles, "readonly=1");
	mParams.addParam("Volume", &mVolume, "readonly=1");
	mParams.addParam("Scale", &listener.mScale, "min=0.1 max=40.0 step=0.1");
	
}
void kinectPointCloudApp::setup()
{	
	// SETUP PARAMS
	mParams = params::InterfaceGl( "KinectPointCloud", Vec2i( 200, 180 ) );
	mParams.addParam( "Scene Rotation", &mSceneRotation, "opened=1" );
	mParams.addParam( "Cam Distance", &mCameraDistance, "min=100.0 max=5000.0 step=100.0 keyIncr=s keyDecr=w" );
	mParams.addParam( "Kinect Tilt", &mKinectTilt, "min=-31 max=31 keyIncr=T keyDecr=t" );
	
	// SETUP CAMERA
	mCameraDistance = 1000.0f;
	mEye			= Vec3f( 0.0f, 0.0f, mCameraDistance );
	mCenter			= Vec3f::zero();
	mUp				= Vec3f::yAxis();
	mCam.setPerspective( 75.0f, getWindowAspectRatio(), 1.0f, 8000.0f );
	
	// SETUP KINECT AND TEXTURES
	console() << "There are " << Kinect::getNumDevices() << " Kinects connected." << std::endl;
	mKinect			= Kinect( Kinect::Device() ); // use the default Kinect
	mDepthTexture	= gl::Texture( 640, 480 );
	
	// SETUP VBO AND SHADER	
	createVbo();
	mShader	= gl::GlslProg( loadResource( RES_VERT_ID ), loadResource( RES_FRAG_ID ) );
	
	// SETUP GL
	gl::enableDepthWrite();
	gl::enableDepthRead();
}
Exemplo n.º 16
0
void LookAroundYouApp::setup()
{
	Rand::randomize();
	
    mVolume = 1.0;
    
    // Setup GUI
	getWindow()->setTitle("MPCDigital App");
	mParams = params::InterfaceGl( "Settings", Vec2i( 300, 200 ) );
	mParams.addParam( "Framerate", &mFrameRate, "", true );
    mParams.addSeparator();
    mParams.addParam("Speed", &Boid::speedMultiplier, "min=0.5 max=5.0 step=0.01");
    mParams.addParam("Radius", &Boid::radiusMultiplier, "min=0.5 max=5.0 step=0.01");
    mParams.addParam("Range", &Boid::range, "min=10.0 max=100 step=0.1");
    mParams.addSeparator();
    mParams.addParam("Master Volume", &mVolume, "min=0 max=1.0 step=0.01");
    
    
    // Setup Audio
    AudioDevice::printDeviceMap();
    mAudioDevice = make_shared<AudioDevice>();
    mAudioDevice->setup(0);
    mAudioDevice->setAmbientReverb(FMOD_PRESET_UNDERWATER);
    console() << "Channels Available: " << mAudioDevice->getNumRemainingChannels() << endl;
    
    DataSourceRef data = loadAsset("music/Music For Airports - 1 1.mp3");
    string musicName = mAudioDevice->registerSound(data, true, false, true);
    music = mAudioDevice->getSoundInstance(musicName, 1.0);
    music->pause();
    
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/blue.aif"), true, true));
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/fliup.aif"), true, true));
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/green.aif"), true, true));
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/howl.wav"), true, true));
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/orange.aif"), true, true));
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/red.aif"), true, true));
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/white.aif"), true, true));
    fxnames.push_back(mAudioDevice->registerSound(loadAsset("fx/yellow.aif"), true, true));
    
    // Setup noise generator to drive Boid motion
    mPerlin = new Perlin();
    mPerlin->setSeed(clock());
	mPerlin->setOctaves(1);
    
    // Construct Boids
    for(int i=0; i<10; i++) {
        int n = Rand::randInt(0, fxnames.size());
        SoundInstanceRef fx = mAudioDevice->getSoundInstance(fxnames[n], 1.0);
        BoidRef boid = make_shared<Boid>(mPerlin, fx);
        mBoids.push_back(boid);
    }
    
	
	// enable the depth buffer (for 3D)
	gl::enableDepthRead();
	gl::enableDepthWrite();
    gl::enableAlphaBlending();
}
Exemplo n.º 17
0
    void setup() { // вызавется при запуске приложения
        objectPosition =  Vec3f::zero();
        cameraDistance = 500; // выставим значение по умолчанию от камеры до цели
        camera.setPerspective( 60.0f, getWindowAspectRatio(), 5.0f, 3000.0f ); // настроим преспективу камеры

        cameraParams = params::InterfaceGl( "Camera Settings", Vec2i( 225, 200 ) ); // создадим окно интерфейса (название, размер)
        cameraParams.addParam( "Scene Rotation", &sceneRotation ); // окно может управлять вращением сцены
        cameraParams.addParam( "Eye Distance", &cameraDistance, "min=50.0 max=1000.0 step=50.0 keyIncr=s keyDecr=w" ); // окно может управлять расстоянием от того гда камера до того куда она смотрит (подробнее о параметрах http://anttweakbar.sourceforge.net/doc/tools%3aanttweakbar%3avarparamsyntax)
    }
Exemplo n.º 18
0
void SpriteSheetGeneratorApp::setup()
{
  mParams = params::InterfaceGl( "SpriteSheet Generator", Vec2i( 200, 200 ) );
  mParams.setOptions( "", "position='50 450'" );
  mParams.addParam( "Preview scaling", &mWindowScaling, "min=0.1 max=2.0 step=0.05");
  mParams.addParam( "Preview offset", &mPreviewOffset.y );
  mParams.addParam( "Output name", &mFilename );
  mParams.addButton( "Save sheet", [this](){ saveSpriteSheet(); } );
}
Exemplo n.º 19
0
void FxApp::setupParams()
{
	mParams.clear();

	mParams.addParam( "Effect", mEffectNames, &mCurrentEffect );

	mParams.addSeparator();

	mParams.addText( mEffects[ mCurrentEffect ]->getName() );
	mEffects[ mCurrentEffect ]->addToParams( mParams );

	mParams.addSeparator();
	mParams.addParam( "Fps", &mFps, "", true );
}
Exemplo n.º 20
0
void ContoursApp::setup()
{	
	mKinect = Kinect( Kinect::Device() );
	mKinectReady = false;
	mKinectIR = false;
	
	silhouetteDetector = new SilhouetteDetector(640,480);
	contours = new vector<vector<cv::Point> >();
	
	mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 100 ) );
	mParams.addParam( "Near Threshold", &silhouetteDetector->mNearThreshold, "min=0 max=255 step=1.0 keyIncr=z keyDecr=Z" );
	mParams.addParam( "Far Threshold", &silhouetteDetector->mFarThreshold, "min=0 max=255 step=1.0 keyIncr=x keyDecr=X" );
	mParams.addParam( "Blur Amount", &silhouetteDetector->mBlurAmt, "min=0 max=20 step=1.0 keyIncr=b keyDecr=B" );
}
void PaintingBeingsApp::updateInterface(bool readOnlyAlgoGenParams)
{
	_params.clear();

	// FrameRate
	_params.addParam("Frame rate", &_frameRate, "", true);

	// Taille de l'image miniature à recréer
	_params.addParam("Image size", &(_image.getMiniatureSize()), "min=10 max=100 step=5", readOnlyAlgoGenParams);

	// Taille de la population de l'algo gen
	_params.addParam("Population size", &(_algoGen.getPopulationSize()), "min=10 max=100 step=5", readOnlyAlgoGenParams);

	// Pourcentage pour l'algo gen
	_params.addParam("% Survivor", &(_algoGen.getThresholdSurvivor()), "min=5 max=50 step=1", readOnlyAlgoGenParams);
	_params.addParam("% Crossover", &(_algoGen.getThresholdCrossover()), "min=5 max=50 step=1", readOnlyAlgoGenParams);
	_params.addParam("% Mutation", &(_algoGen.getThresholdMutation()), "min=5 max=50 step=1", readOnlyAlgoGenParams);
	_params.addParam("% Leftover", &(_algoGen.getThresholdNewPopulation()), "min=5 max=50 step=1", readOnlyAlgoGenParams);

	// Resolution des Beings
	_params.addParam("Resolution", &(_imageBeing.getResolution()), "min=1 max=10 step=1", readOnlyAlgoGenParams);


	// Espacement entre cube de l'image Being
	_params.addParam("Spacing", &(_imageBeing.getSpacing()), "min=0 max=20 step=0.1", false);

	// Frequence du twist pour la déformation GLSL
	_params.addParam("Angle Max Twist", &(_imageBeing.getAngleMax()), "min=1.0 max=360.0 step=1.0", false);


	// Bouton capturant une image de la webCam
	_params.addButton("Webcam Shot", bind(&PaintingBeingsApp::captureCamera, this));
	// Bouton pour faire un screen shot de l'image Being
	_params.addButton("Save image Being", bind(&PaintingBeingsApp::screenShot, this));

	// Bouton pour modifier l'état de l'application
	_params.addButton("Play", bind(&PaintingBeingsApp::setPlay, this));
	_params.addButton("Pause", bind(&PaintingBeingsApp::setPause, this));
	_params.addButton("Stop", bind(&PaintingBeingsApp::setStop, this));

	// Option interface
	_params.addButton("Switch Image/Being", bind(&PaintingBeingsApp::setDisplayBeing, this));
	_params.addButton("Wireframe", bind(&PaintingBeingsApp::setShowWireFrame, this));

	// Reset position camera
	_params.addButton("Reset Camera", bind(&PaintingBeingsApp::resetCamera, this));

	_params.addButton("Quit", bind(&PaintingBeingsApp::closeApp, this));
}
Exemplo n.º 22
0
void bordaiApp::setup() {
	mParams = params::InterfaceGl("bordai", Vec2i(300, 175));
	mParams.addParam("Screen width", &mWindowSize.x, "", true);
	mParams.addParam("Screen height", &mWindowSize.y, "", true);
	mParams.addParam("Camera width", &mCameraLensSize.x, "min=128 max=1024 step=64 keyIncr=W keyDecr=w");
	mParams.addParam("Camera height", &mCameraLensSize.y, "min=128 max=1024 step=64 keyIncr=H keyDecr=h");
	mParams.addSeparator();
	mParams.addText("Press space to apply new camera resolution");
	mParams.addText("Press 'p' to pause/play camera");
	mParams.addSeparator();
	mParams.addParam("Framerate", &mFrameRate, "min=5.0 max=70.0 step=5.0 keyIncr=+ keyDecr=-");
	
	mHaarDetector = HaarDetector( getResourcePath( "haarcascade_frontalface_alt2.xml" ) );
	mCamera.startCapturing(mCameraLensSize.x, mCameraLensSize.y);
}
Exemplo n.º 23
0
void BasicApp::setup()
{
	setWindowSize(800, 600);

	configFilename = "config.xml"; 
	bgColor = Color::black();

	showRect = true;
	rectRot = 0.f;
	rectColor = ColorA::gray(0.5f);
	rectPosition = Vec3f::zero();

	showCircle = true;
	circleRadius = 70.f;
	circleColor = ColorA::gray(0.7f);
	circlePosition = Vec3f::zero();

	text = "Config Block for Cinder";

	doubleParam = 0.0; intParam = 0; quatfParam = Quatf();
	
	enumNames.push_back( "Orange" );
	enumNames.push_back( "Apple" );
	enumNames.push_back( "Banana" );
	enumValue = 0;

	//-----------------------------------------------------------------------------

    mParams = params::InterfaceGl( "Settings", Vec2i( 400, 550 ) );
    mConfig = new config::Config(&mParams);
    
    mParams.addParam("Configuration file name", &configFilename);
    mParams.addButton("Save config", bind(&BasicApp::saveConfig, this));
    mParams.addButton("Load config", bind(&BasicApp::loadConfig, this));
    mParams.addSeparator();
	
    mConfig->addParam("Background color", &bgColor);
    mConfig->addParam("Text", &text);
    mParams.addSeparator();

	mConfig->newNode("Rectangle");
    mConfig->addParam("Show rectangle", &showRect);
    mConfig->addParam("Rectangle rotation", &rectRot);
    mConfig->addParam("Rectangle color", &rectColor);
	mConfig->addParam("Rectangle position", &rectPosition);
    mParams.addSeparator();

	mConfig->newNode("Circle");
	mConfig->addParam("Show circle", &showCircle);
    mConfig->addParam("Circle radius", &circleRadius);
    mConfig->addParam("Circle color", &circleColor);
	mConfig->addParam("Circle position", &circlePosition);

	mConfig->newNode("Other");
	mConfig->addParam("Double type parameter", &doubleParam);
	mConfig->addParam("Int type parameter", &intParam);
	mConfig->addParam("Quatf type parameter", &quatfParam);
	mConfig->addParam("Enum type parameter", enumNames, &enumValue);

}
Exemplo n.º 24
0
void ocvWarpApp::setup()
{
    mInputImage = ci::Surface8u( loadImage( loadAsset( "aus.jpg" ) ) );

    mRotationCenter = vec2( mInputImage.getSize() ) * 0.5f;
    mRotationAngle = 31.2f;
    mScale = 0.77f;

    mParams = params::InterfaceGl( "Parameters", ivec2( 200, 400 ) );
    mParams.addParam( "Rotation Center X", &mRotationCenter.x );
    mParams.addParam( "Rotation Center Y", &mRotationCenter.y );
    mParams.addParam( "Rotation Angle", &mRotationAngle );
    mParams.addParam( "Scale", &mScale, "step=0.01" );

    updateImage();
}
Exemplo n.º 25
0
void ocvWarpApp::setup()
{		
	mInputImage = ci::Surface8u( loadImage( loadResource( RES_IMAGE ) ) );

	mRotationCenter = mInputImage.getSize() * 0.5f;
	mRotationAngle = 31.2f;
	mScale = 0.77f;
	
	mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 400 ) );
	mParams.addParam( "Rotation Center X", &mRotationCenter.x );
	mParams.addParam( "Rotation Center Y", &mRotationCenter.y );
	mParams.addParam( "Rotation Angle", &mRotationAngle );
	mParams.addParam( "Scale", &mScale, "step=0.1" );

	updateImage();
}
Exemplo n.º 26
0
void TweakBarApp::setup()
{
	mObjSize = 4;
	mLightDirection = Vec3f( 0, 0, -1 );
	mColor = ColorA( 0.25f, 0.5f, 1.0f, 1.0f );

	// setup our default camera, looking down the z-axis
	mCam.lookAt( Vec3f( -20, 0, 0 ), Vec3f::zero() );

	// Setup the parameters
	mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 400 ) );
	mParams.addParam( "Cube Size", &mObjSize, "min=0.1 max=20.5 step=0.5 keyIncr=z keyDecr=Z" );
	mParams.addParam( "Cube Rotation", &mObjOrientation );
	mParams.addParam( "Cube Color", &mColor, "" );	
	mParams.addSeparator();	
	mParams.addParam( "Light Direction", &mLightDirection, "" );
}
Exemplo n.º 27
0
void MatrixStudyApp::setup()
{
    // SETUP CAMERA
	mCameraDistance = 1200.0f;
	mEye			= Vec3f( 0.0f, 0.0f, mCameraDistance );
	mCenter			= Vec3f( 0.0f, 0.0f, 0.0f );
	mUp				= Vec3f::yAxis();
	mCam.setPerspective( 75.0f, getWindowAspectRatio(), 5.0f, 3000.0f );
    
    // CAMERA ROTATION
    xAngle = 0.0f;
    yAngle = 0.0f;
    zAngle = 0.0f;
    
    //PARAMS
    mParams = params::InterfaceGl( "Control Panel", Vec2i( 200, 160 ) );
    mParams.addParam( "Scene Rotation", &mSceneRotation );
    mParams.addParam( "Eye Distance", &mCameraDistance, "min=50.0 max=1500.0 step=50.0 keyIncr=s keyDecr=w" );
    mParams.addParam( "X Angle", &xAngle, "min=0.0 max=360.0 step=5.0 keyIncr=r keyDecr=f" );
    mParams.addParam( "Y Angle", &yAngle, "min=0.0 max=360.0 step=5.0 keyIncr=t keyDecr=g" );
    mParams.addParam( "Z Angle", &zAngle, "min=0.0 max=360.0 step=5.0 keyIncr=y keyDecr=h" );

    
    mDirectional = 1.0f;
    
    glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
	
	gl::enableDepthWrite();
	gl::enableDepthRead();
	gl::enableAlphaBlending();
    
    glDisable( GL_TEXTURE_2D );
    
    
    // Set up coordinates
    
    mLocalStartPosition.set(100.0f, 100.0f, 0.0f);
    mLocalBasisRotation.set(20.0f, 30.0f, 45.0f);
    mLocalObjectRotation.set(0.0f, 30.0f, 60.0f);
    mLocalEndPosition.set( 0.0f, 300.0f, 0.0f); //I know what the local end position is because I'm drawing a cylinder of length 300. 
    
    mWorldEndPosition = getWorldEndPosition( mLocalStartPosition, mLocalBasisRotation, mLocalObjectRotation, mLocalEndPosition );
  
    mShowCube = true;
    
}
Exemplo n.º 28
0
void DepthProcessor::setup(params::InterfaceGl& params)
{
	mStepFrom = 1;
	mAreaThreshold = 2000.0f;
  mDrawTex = dtDepth;

  std::vector<std::string> enumSource;
  enumSource.push_back("None");
  enumSource.push_back("Kinect");
  enumSource.push_back("Fake");
  enumSource.push_back("Recorded");
  params.addParam( "Depth Source", enumSource, (int*) &mDepthType);
	params.addParam( "Init frame amount", &mInitFrames, "min=0 max=300" );
	params.addParam( "Step from", &mStepFrom, "min=1 max=255" );
  params.addParam( "Depth LowPass filter", &mDepthLowPass, "min=0 max=255");
	params.addParam( "CV area threshold", &mAreaThreshold, "min=1");
  std::vector<std::string> enumDraw;
  enumDraw.push_back("Depth");
  enumDraw.push_back("Color");
  enumDraw.push_back("Contour");
  enumDraw.push_back("Background");
  params.addParam( "Texture", enumDraw, &mDrawTex);
  params.addParam( "Record Depth Data", &mRecordRequested);

  mKinectDepthSource = std::make_shared<KinectDepthSource>(params);
  mDepthSource = mKinectDepthSource;
  mFakeDepthSource = std::make_shared<FakeDepthSource>();
  mVideoDepthSource = std::make_shared<VideoDepthSource>();
  
  mProcessingThread = std::thread(std::bind(&DepthProcessor::threadFunc, this));
}
Exemplo n.º 29
0
void screenSaverTestApp::setup()
{
  Rand::randomize();
  gl::enableAlphaBlending();
  gl::clear( Color( 1.0, 1.0, 1.0) );
  glEnable(GL_LINE_SMOOTH);
  mReset = 0;
  mTime = getElapsedSeconds();
  mLastDraw = mTime;

  mStartingWidth = 11.0;
  mMaxDepth = 12;
  mSegmentLengthMin = 4;
  mSegmentLengthMax = 14;
  mBranchRotationMin = -13.0f;
  mBranchRotationMax = 11.0f;
  mProbBranch = 0.7f;
  mScaleReduction = 0.7f;
  mBranchRotationMin2 = 10.0f;
  mBranchRotationMax2 = 20.0f;

  // Setup the parameters
  mParams = params::InterfaceGl( "Parameters", Vec2i( 200, 400 ) );
  mParams.addParam( "Starting Width", &mStartingWidth, "min=1 max=20 step=1" );
  mParams.addParam( "Max Depth", &mMaxDepth, "min=1 max=20 step=1" );
  mParams.addParam( "Seg Length (min)", &mSegmentLengthMin, "min=1 max=30 step=1" );
  mParams.addParam( "Seg Length (max)", &mSegmentLengthMax, "min=1 max=30 step=1" );
  mParams.addParam( "Branch Rotation (min)", &mBranchRotationMin, "min=-360 max=360 step=1" );
  mParams.addParam( "Branch Rotation (max)", &mBranchRotationMax, "min=-360 max=360 step=1" );
  mParams.addParam( "Prob Branch", &mProbBranch, "min=0.0 max=1.0 step=0.05" );
  mParams.addParam( "Scale Reduction", &mScaleReduction, "min=0.0 max=1.0 step=0.05" );
  mParams.addParam( "Branch Rotation 2 (min)", &mBranchRotationMin2, "min=-360 max=360 step=1" );
  mParams.addParam( "Branch Rotation 2 (max)", &mBranchRotationMax2, "min=-360 max=360 step=1" );
}
Exemplo n.º 30
0
void HandTrackingApp::setup()
{
 
    mThreshold = 70.0f;
    mBlobMin = 20.0f;
    mBlobMax = 80.0f;
 
    mParams = params::InterfaceGl( "Hand Tracking", Vec2i( 10, 10 ) );
    mParams.addParam( "Threshold", &mThreshold, "min=0.0 max=255.0 step=1.0 keyIncr=s keyDecr=w" );
    mParams.addParam( "Blob Minimum Radius", &mBlobMin, "min=1.0 max=200.0 step=1.0 keyIncr=e keyDecr=d" );
    mParams.addParam( "Blob Maximum Radius", &mBlobMax, "min=1.0 max=200.0 step=1.0 keyIncr=r keyDecr=f" );
    mParams.addParam( "Kinect Tilt", &mKinectTilt, "min=-31 max=31 keyIncr=T keyDecr=t" );
 
    mKinect = Kinect( Kinect::Device() );
 
    mTargetPosition = Vec3f::zero();
 
}