void CameraComponent::loadGUI(const ci::params::InterfaceGlRef &gui)
{
    gui->addSeparator();
    gui->addText( mContext->getName() +" : "+ getName());
    auto updateFn = std::bind(&CameraComponent::updateCameraParams, this);
    gui->addParam( mContext->getName() +" : FOV", &mFov).updateFn(updateFn);
    gui->addParam( mContext->getName() +" : Far", &mFar).updateFn(updateFn);
    gui->addParam( mContext->getName() +" : Near", &mNear).updateFn(updateFn);
    gui->addParam( mContext->getName() +" : Interest Point", &mInterestPoint);

}
void OSCComponent::loadGUI(const ci::params::InterfaceGlRef &gui)
{
    gui->addSeparator();
    gui->addText( mContext->getName() +" : "+ getName());
    auto updateFn = [&]{ mListener.setup(mListenPort); };
    gui->addParam("listen port", &mListenPort).updateFn(updateFn);
    
    ///TODO:: change osc sender gui update
    
//    auto loadFn = [&]{
//        auto tree = ec::ConfigManager::get()->retreiveComponent(ec::Controller::get()->scene().lock()->getName(), mContext->getName(), getName() );
//        auto ip = tree["send_ip"].getValue();
//        auto port = tree["send_port"].getValue<int>();
//        mSendPort = port;
//        mSendIp = ip;
//        mSender.setup(mSendIp, mSendPort);
//    };
//    gui->addButton("reload osc sender", loadFn );

}
예제 #3
0
void SegmentationApp::initInterface()
{
    interface->clear();
    
    if (guiMode == GUI_MODE::LOAD_IMAGE) {
        interface->addButton( "Open Image", std::bind( &SegmentationApp::openImage, this ) );        
    }
    else if (guiMode == GUI_MODE::LOAD_GROUNDTRUTH) {
        interface->addButton( "Open Ground Truth", std::bind( &SegmentationApp::openGroundTruth, this ) );
        //interface->addButton( "Open Doctor Image", std::bind( &SegmentationApp::openDoctorImage, this ) );
        interface->addSeparator();
        interface->addParam("filter radius", &filterRadius).min(0).max(10).step(1);
        interface->addButton( "Mean Filter", std::bind( &SegmentationApp::meanFilter, this ) );
        interface->addButton( "Median Filter", std::bind( &SegmentationApp::medianFilter, this ) );
        interface->addButton( "Min Filter", std::bind( &SegmentationApp::minFilter, this ) );
        interface->addButton( "Max Filter", std::bind( &SegmentationApp::maxFilter, this ) );
        interface->addSeparator();
        interface->addButton( "Get Hue", std::bind( &SegmentationApp::getHue, this ) );
        interface->addSeparator();
        interface->addParam("hue threshold", &hueThreshold).min(0).max(PI).step(.005).updateFn([this] () {
            thresholdHue(); });;
        interface->addParam("angle", &hueAngle).min(-PI).max(PI).step(.005).updateFn([this] () {
            thresholdHue(); });;
        interface->addButton( "threshold hue", std::bind( &SegmentationApp::thresholdHue, this ) );
        interface->addSeparator();
        interface->addParam("green weight", &greenWeight).min(0).max(5).step(.01).updateFn([this] () {
            experimentalColorDistance(); });;
        interface->addParam("blue weight", &blueWeight).min(0).max(5).step(.01).updateFn([this] () {
            experimentalColorDistance(); });;
        interface->addButton( "experimental threshold", std::bind( &SegmentationApp::experimentalColorDistance, this ) );
        interface->addSeparator();
        interface->addParam("otsus Iterations", &otsusIterations).min(1).max(5).step(1);

        interface->addButton( "otsus red", std::bind( &SegmentationApp::redOtsusThreshold, this ) );
        interface->addButton( "otsus green", std::bind( &SegmentationApp::greenOtsusThreshold, this ) );
        interface->addButton( "otsus blue", std::bind( &SegmentationApp::blueOtsusThreshold, this ) );
        interface->addButton( "otsus gray", std::bind( &SegmentationApp::grayOtsusThreshold, this ) );
        interface->addButton( "otsus best", std::bind( &SegmentationApp::multiImageOtsusThreshold, this ) );
        
        //interface->addButton( "otsus binary mask", std::bind( &SegmentationApp::otsusBinaryMask, this ) );
        //interface->addButton( "otsus color union", std::bind( &SegmentationApp::otsusColorUnion, this ) );
        interface->addSeparator();
        interface->addButton( "erode", std::bind( &SegmentationApp::erode, this ) );
        interface->addButton( "dilate", std::bind( &SegmentationApp::dilate, this ) );
        interface->addSeparator();
        interface->addButton( "get largest component", std::bind( &SegmentationApp::getLargestComponents, this ) );
        interface->addButton( "fill holes", std::bind( &SegmentationApp::fillHoles, this ) );
        interface->addSeparator();
        interface->addButton( "show result", std::bind( &SegmentationApp::showResult, this ) );

        //interface->addButton( "otsus edge intersection", std::bind( &SegmentationApp::otsusEdgeIntersection, this ) );
        //interface->addSeparator();
        //interface->addButton( "color gradient", std::bind( &SegmentationApp::getColorGradient, this ) );
        //interface->addButton( "thin edges", std::bind( &SegmentationApp::edgeThinColorGradient, this ) );
        interface->addSeparator();
        
        interface->addButton( "autoSegment", std::bind( &SegmentationApp::autoSegment, this ) );
        
        interface->addText( "Dice Coeddicient : " + std::to_string(diceCoefficientResult) );
        interface->addSeparator();
        interface->addButton( "Reset", std::bind( &SegmentationApp::reset, this ) );
        interface->addSeparator();
        interface->addButton( "Save Input", std::bind( &SegmentationApp::saveInputImage, this ) );
        interface->addButton( "Save Segmentation", std::bind( &SegmentationApp::saveSegmentedImage, this ) );
        interface->addButton( "Save Result", std::bind( &SegmentationApp::saveResultImage, this ) );
        
    }
    else if (guiMode == GUI_MODE::DO_TRAINING) {
        interface->addParam("filter radius", &filterRadius).min(0).max(10).step(1);
        interface->addButton( "Mean Filter", std::bind( &SegmentationApp::meanFilter, this ) );
        interface->addButton( "Median Filter", std::bind( &SegmentationApp::medianFilter, this ) );
        interface->addButton( "Min Filter", std::bind( &SegmentationApp::minFilter, this ) );
        interface->addButton( "Max Filter", std::bind( &SegmentationApp::maxFilter, this ) );
        interface->addSeparator();
        interface->addButton( "Open Doctor Image", std::bind( &SegmentationApp::openDoctorImage, this ) );
        interface->addSeparator();
        interface->addButton( "Train", std::bind( &SegmentationApp::trainImage, this ) );
    }
    else if (guiMode == GUI_MODE::DO_DOCTOR_TRAINING) {
        
        
        interface->addParam("filter radius", &filterRadius).min(0).max(10).step(1);
        interface->addButton( "Mean Filter", std::bind( &SegmentationApp::meanFilter, this ) );
        interface->addButton( "Median Filter", std::bind( &SegmentationApp::medianFilter, this ) );
        interface->addSeparator();
        interface->addButton( "Doctor Training", std::bind( &SegmentationApp::trainDoctorImage, this ) );
    }
    else if (guiMode == GUI_MODE::THRESHOLD) {
        interface->addButton( "Show Mean Distance", std::bind( &SegmentationApp::getColorDistance, this ) );
        interface->addButton( "Threshold Color", std::bind( &SegmentationApp::thresholdColor, this ) );
        interface->addParam("color distance", &colorThreshold).min(0.f).max(255.f).step(1).updateFn([this] () {
            thresholdColor(); });
        interface->addSeparator();
        interface->addButton( "Threshold Mahalonobis", std::bind( &SegmentationApp::thresholdMahalonobis, this ) );
        interface->addParam("mahalonobis distance", &mahalonobisThreshold).min(0.f).max(255.f).step(1);
    }
    interface->addSeparator();
    
}
void ComponentTemplate::loadGUI(const ci::params::InterfaceGlRef &gui)
{
    gui->addSeparator();
    gui->addText(getName());
}
예제 #5
0
void GpGpuApp::setup()
{
	// Load shaders
	try {
		mGlslProgDraw = gl::GlslProg::create( loadResource( RES_GLSL_DRAW_VERT ), loadResource( RES_GLSL_DRAW_FRAG ) );
	} catch ( gl::GlslProgCompileExc ex ) {
		console() << ex.what() << "\n";
		quit();
	}
	
	try {
		mGlslProgGpGpu0 = gl::GlslProg::create( loadResource( RES_GLSL_GPGPU_VERT ), loadResource( RES_GLSL_GPGPU0_FRAG ) );
	} catch ( gl::GlslProgCompileExc ex ) {
		console() << ex.what() << "\n";
		quit();
	}
	
	try {
		mGlslProgGpGpu1 = gl::GlslProg::create( loadResource( RES_GLSL_GPGPU_VERT ), loadResource( RES_GLSL_GPGPU1_FRAG ) );
	} catch ( gl::GlslProgCompileExc ex ) {
		console() << ex.what() << "\n";
		quit();
	}
	
	// Define all properties
	mArcball					= Arcball( getWindowSize() );
	mBrushSize					= 0.1f;
	mCamera						= CameraPersp( getWindowWidth(), getWindowHeight(), 60.0f, 1.0f, 100000.0f );
	mEyePoint					= Vec3f( 0.0f, 20.0f, 256.0f );
	mFullScreen					= isFullScreen();
	mFullScreenPrev				= mFullScreen;
	mLightAmbient				= ColorAf::gray( 0.1f );
	mLightAttenuationConstant	= 0.1f;
	mLightAttenuationLinear		= 0.01f;
	mLightAttenuationQuadratic	= 0.001f;
	mLightDiffuse				= ColorAf( 0.9f, 0.3f, 0.667f );
	mLightPosition				= Vec3f( 11.38f, -1.39f, 59.74f );
	mLightSpecular				= ColorAf::white();
	mLightShine					= 1.0f;
	mMaterialAmbient			= 1.0f;
	mMaterialDiffuse			= 1.0f;
	mMaterialEmissive			= 0.0f;
	mMaterialSpecular			= 1.0f;
	mMesh						= gl::VboMesh::create( MeshHelper::createCube() );
	mMouseDown					= false;
	mMouse						= Vec2f::zero();
	mMouseVelocity				= Vec2f::zero();
	mParams						= params::InterfaceGl::create( "Params", Vec2i( 250, 400 ) );
	mSize						= Vec2i( 512, 512 );
	mSizePrev					= Vec2i::zero();
	mTextureBrush				= gl::Texture::create( loadImage( loadResource( RES_PNG_BRUSH ) ) );
	
	// Set up arcball
	mArcball.setRadius( (float)getWindowHeight() * 0.5f );
	
	// Set up parameters
	mParams->addParam( "Frame rate",		&mFrameRate,					"", true );
	mParams->addParam( "Full screen",		&mFullScreen,					"key=f" );
	mParams->addButton( "Quit",				bind( &GpGpuApp::quit, this ),	"key=q" );
	
	mParams->addSeparator( "" );
	mParams->addParam( "Brush size",		&mBrushSize,					"min=0.0 max=1.0 step=0.001" );
	mParams->addParam( "Size X",			&mSize.x,						"min=1 max=1024 step=1" );
	mParams->addParam( "Size Y",			&mSize.y,						"min=1 max=1024 step=1" );
	
	mParams->addSeparator( "" );
	mParams->addParam( "Light ambient",		&mLightAmbient );
	mParams->addParam( "Light att const",	&mLightAttenuationConstant,		"min=0.0 max=1.0 step=0.001" );
	mParams->addParam( "Light att line",	&mLightAttenuationLinear,		"min=0.0 max=1.0 step=0.0001" );
	mParams->addParam( "Light att quad",	&mLightAttenuationQuadratic,	"min=0.0 max=1.0 step=0.00001" );
	mParams->addParam( "Light diffuse",		&mLightDiffuse );
	mParams->addParam( "Light position",	&mLightPosition );
	mParams->addParam( "Light specular",	&mLightSpecular );
	mParams->addParam( "Light shine",		&mLightShine,					"min=0.0 max=100000.0 step=1.0" );
	
	mParams->addSeparator( "" );
	mParams->addParam( "Material ambient",	&mMaterialAmbient,				"min=0.0 max=1.0 step=0.001" );
	mParams->addParam( "Material diffuse",	&mMaterialDiffuse,				"min=0.0 max=1.0 step=0.001" );
	mParams->addParam( "Material emissive",	&mMaterialEmissive,				"min=0.0 max=1.0 step=0.001" );
	mParams->addParam( "Material specular",	&mMaterialSpecular,				"min=0.0 max=1.0 step=0.001" );
}