Exemplo n.º 1
0
void ofxUITabBar::addCanvas(ofxUIScrollableCanvas *_canvas)
{
    ofxUIToggle* newToggle = addToggle(_canvas->getName(), false);
    canvases.insert ( pair<ofxUIToggle*, ofxUICanvas*>( newToggle, _canvas) );
    _canvas->disable();
    autoSizeToFitWidgets();
}
void ContourFindingFilter::setup() 
{
	GrayscaleFilter::setup();

	addContent("Output", output);
	addSlider("Blobs", settings.num_blobs, 1, 10);
	addToggle("Find Holes", settings.find_holes);
}
Exemplo n.º 3
0
void CalibrationFilter::setup() 
{
	ColorFilter::setup();

	grayInput.allocate(videoSize.x, videoSize.y);
	tempImage.allocate(videoSize.x, videoSize.y);
	shownCapture.allocate(videoSize.x, videoSize.y);
	
	addContent("Output", &output);
	showCapturesSlider = addSlider("Previous Captures", &settings.show_capture, 0, settings.min_captures);
	addContent("Selected Capture", &shownCapture);
	addButton("Capture", &settings.capture);
//	addToggle("Once", &settings.once);
//	addSlider2d("Chessboard Corners", &targetCorners, 2.0, 7.0, 2.0, 7.0);
	addToggle("Interpolate", &settings.do_interpolate);
	addButton("Calculate", &settings.calc_undistort);
	addToggle("Undistort Stream", &settings.do_undistort);
	addToggle("Guess Lens Intrinsics", &settings.guess_intrinsics);
}
Exemplo n.º 4
0
void ThresholdingFilter::setup() 
{
	GrayscaleFilter::setup();

	addContent("Output", output);
	addSlider("Threshold", settings.threshold, 0, 255);
	addSlider("Max Value", settings.max_value, 0, 255);
	addSlider("Mode", settings.mode, 0, 4);
	addToggle("Use Otsu", settings.use_otsu);
}
Exemplo n.º 5
0
void GuiApp::setup(void)
{
    ofSetWindowTitle("Controls");

    gui = new ofxDatGui(ofxDatGuiAnchor::TOP_LEFT);

    auto theme = new GuiTheme();
    gui->setTheme(theme);

    gui->addHeader("boids");
    gui->getHeader()->setDraggable(false);

    gui->addFRM(0.1);
    auto fps_toggle = gui->addToggle("cap to 30 FPS");
    fps_toggle->toggleEventCallback = std::bind(&GuiApp::fpsCapToggleEvent, this, std::placeholders::_1);

    gui->addBreak();
    gui->addLabel("boid controls");
    for (const auto &type_boid_pair : Config::boids_by_type) {
        const auto &boid_type = type_boid_pair.first;
        const auto &boid_type_config = type_boid_pair.second;

        auto boid_type_folder = gui->addFolder(BoidMisc::typeToTypename(boid_type));

        auto amount_slider = boid_type_folder->addSlider("amount", 1, 1200);
        amount_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeAmountChanged, this, std::placeholders::_1, boid_type);
        amount_slider->setPrecision(0);
        amount_slider->setValue(boid_type_config.amount);

        auto infl_max_dist_slider = boid_type_folder->addSlider("infl max dist", 1, 120, boid_type_config.infl_max_dist);
        infl_max_dist_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeInflMaxDistChanged, this, std::placeholders::_1, boid_type);

        auto angle_of_view_slider = boid_type_folder->addSlider("angle of view", 10, 180, boid_type_config.angle_of_view);
        angle_of_view_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeAngleOfViewChanged, this, std::placeholders::_1, boid_type);

        auto max_speed_slider = boid_type_folder->addSlider("max speed", 0.5, 10, boid_type_config.max_speed);
        max_speed_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeMaxSpeedChanged, this, std::placeholders::_1, boid_type);

        auto color_picker = boid_type_folder->addColorPicker("color", boid_type_config.graphics.color);
        color_picker->colorPickerEventCallback = std::bind(&GuiApp::boidTypeColorChanged, this, std::placeholders::_1, boid_type);

        auto size_slider = boid_type_folder->addSlider("size", 1, 4);
        size_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeSizeChanged, this, std::placeholders::_1, boid_type);
        size_slider->setPrecision(0);
        size_slider->setValue(boid_type_config.graphics.size); // We need to set this after the precision so that the proper precision is applied

        auto draw_head_toggle = boid_type_folder->addToggle("draw head", boid_type_config.graphics.draw_head);
        draw_head_toggle->toggleEventCallback = std::bind(&GuiApp::boidTypeDrawHeadChanged, this, std::placeholders::_1, boid_type);
    }

    ofBackground(theme->color.guiBackground);

    ofSetFrameRate(60);
}
Exemplo n.º 6
0
ramPresetTab::ramPresetTab()
:ofxUITab("Presets", false)
,preset_cam_index(1)
,use_node_cam(false)
,cam_position(false)
,cam_look_at(false)
{
	// should probably be a list of named presets instead of a grid
    addLabelButton("Line", false);
    addLabelButton("Hasty Chase", false);
    addLabelButton("HC + Stamp", false);
    addLabelButton("HC + Stamp + Natto", false);
    addLabelButton("HC + Future", false);
	addLabelButton("Line + Future", false);
// ignore win32
#ifndef TARGET_WIN32
	addLabelButton("Particles + Future", false);
	addLabelButton("Particles", false);
#else
	addLabelButton("Future", false); // only for windows
#endif
	addSpacer();
	
	vector<string> cameraPresetNames;
	cameraPresetNames.push_back("Low");
	cameraPresetNames.push_back("High");
	cameraPresetNames.push_back("Overhead");
	preset_cam_radio = addRadio("Camera position", cameraPresetNames);
	preset_cam_radio->getToggles()[preset_cam_index]->setValue(true);
	addSpacer();
	
    // nodecam
    addLabel("NodeCam", OFX_UI_FONT_LARGE);
    addLabel("1. Click a node on actor", OFX_UI_FONT_SMALL);
    addLabel("which you want to set as", OFX_UI_FONT_SMALL);
    addLabel("camera pos or lookAt.", OFX_UI_FONT_SMALL);
    
    addLabel("2. Click a button below.", OFX_UI_FONT_SMALL);
    addLabel("a joint with red circle", OFX_UI_FONT_SMALL);
    addLabel("will be set as pos or lookAt.", OFX_UI_FONT_SMALL);
    addButton("Set Camera Position", &cam_position, 15, 15);
    addButton("Set Camera LookAt", &cam_look_at, 15, 15);
    
    addLabel("3. Enable NodeCam.", OFX_UI_FONT_SMALL);
    addToggle("Enable Node Cam", &use_node_cam, 30, 30);
    
	autoSizeToFitWidgets();
	
	ofAddListener(ofEvents().update, this, &ramPresetTab::update);
	ofAddListener(ofEvents().draw, this, &ramPresetTab::draw);
	ofAddListener(newGUIEvent, this, &ramPresetTab::guiEvent);
}
void PMUICanvasRibbonRenderer::init(int posX, int posY, bool autosize, int width, int height)
{
    PMUICanvasBaseRenderer::init(posX, posY, autosize, width, height);

    gradientImage.load("./gradients/gradient4x_512x160.png");
    numGradients = 4;

    setGlobalSliderHeight(10);
    setGlobalButtonDimension(14);

    { // Brush (basic)
        addSpacer();
        addLabel(STR_BRUSH_BASIC);
        addIntSlider(STR_BRUSH_BASIC_NUMPAINTERS, 1, 100, &numPainters);
        addIntSlider(STR_BRUSH_BASIC_WIDTH, 1, 10, &strokeWidth);
        addSlider(STR_BRUSH_BASIC_SPEED, 1.01f, 100, &speed);
        addToggle(STR_BRUSH_BASIC_ENABLEBOUNCE, &enableBounce);
    }

    { // Brush (advanced)
        addSpacer();
        addLabel(STR_BRUSH_ADVANCED);
        addSlider(STR_BRUSH_ADVANCED_DIVISIONS, 0.001, 4.5, &divisions);
//        addSlider(STR_BRUSH_ADVANCED_EASE, -1.0, 10.0, &ease);
//        addSlider("Ease Randomness",0.0,1.0,&easeRandomness);
//        addIntSlider(STR_BRUSH_ADVANCED_MAXVERT,3, 4000, &pathMaxVertices);
        addSlider("Next Position Delta",0.0,1.0,&nextPositionDelta);
    }

    { // Color mode
        addSpacer();
        addLabel(STR_BRUSH_COLORMODE);

        vector<string> colorModesNames;
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MFIXEDCOLOR);
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MGRSPEED);
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MGREDGES);
        addRadio(STR_BRUSH_COLORMODE_RADIO, colorModesNames, OFX_UI_ORIENTATION_VERTICAL);

        addImageSampler(STR_BRUSH_COLORMODE_GRIMAGE, &gradientImage);
        addIntSlider(STR_BRUSH_COLORMODE_GRID, 1, 4, &gradientId);
        addIntSlider(STR_BRUSH_COLORMODE_GRSPEED, 1, 500, &gradientSpeed);
        addIntSlider(STR_BRUSH_COLORMODE_R, 0, 255, &colorR);
        addIntSlider(STR_BRUSH_COLORMODE_G, 0, 255, &colorG);
        addIntSlider(STR_BRUSH_COLORMODE_B, 0, 255, &colorB);
    }

    if (autosize) autoSizeToFitWidgets();

    loadPreset(selectedPreset);
}
void GuiManager::setup( int fW, int fH )
{
    frameWidth  = fW;
    frameHeight = fH;

    Settings* settings = Settings::getInstance();

    ofxAutoControlPanel::setup(250, 500);

    addPanel("calcOpticalFlowFarneback");
    addSlider("gridSize", 5, 2, 30, true);
    addSlider("pyrScale", .5, 0, 1);
    addSlider("levels", 4, 1, 8, true);
    addSlider("winsize", 8, 4, 64, true);
    addSlider("iterations", 2, 1, 8, true);
    addSlider("polyN", 7, 5, 10, true);
    addSlider("polySigma", 1.5, 1.1, 2);
    addToggle("FARNEBACK_GAUSSIAN", true);

    addPanel("calcOpticalFlowPyrLK");
    addSlider("winSize", 32, 4, 64, true);
    addSlider("maxLevel", 3, 0, 8, true);
    addSlider("maxFeatures", 200, 1, 1000);
    addSlider("qualityLevel", 0.01, 0.001, .02);
    addSlider("minDistance", 4, 1, 16);

    settings->quadWarpOriginal[0].set(0, 0);
    settings->quadWarpOriginal[1].set(frameWidth, 0);
    settings->quadWarpOriginal[2].set(frameWidth, frameHeight);
    settings->quadWarpOriginal[3].set(0, frameHeight);

    settings->quadWarpScaled[0].set(0, 0);
    settings->quadWarpScaled[1].set(frameWidth, 0);
    settings->quadWarpScaled[2].set(frameWidth, frameHeight);
    settings->quadWarpScaled[3].set(0, frameHeight);

    quadGui.setup("undist");
    quadGui.width  = frameWidth;
    quadGui.height = frameHeight;
    quadGui.disableAppEvents();

    ofPoint quadSrc[4];
    quadSrc[0].set(0, 0);
    quadSrc[1].set(frameWidth, 0);
    quadSrc[2].set(frameWidth, frameHeight);
    quadSrc[3].set(0, frameHeight);
    quadGui.setQuadPoints(quadSrc);
    quadGui.bCameraView = true;

}
void FiducialTrackingFilter::setup() 
{
	GrayscaleFilter::setup();
	fidFinder.detectFinger		= true;
	fidFinder.maxFingerSize		= 25;
	fidFinder.minFingerSize		= 5;
	fidFinder.fingerSensitivity	= 0.05f; //from 0 to 2.0f

	addContent("Output", output);
	addToggle("Detect Fingers", fidFinder.detectFinger);
	addSlider("Min Finger Size", fidFinder.minFingerSize, 0, 50);
	addSlider("Max Finger Size", fidFinder.maxFingerSize, 0, 50);
	addSlider("Finger Sensitivity", fidFinder.fingerSensitivity, 0.0, 2.0);
	
	output.set(0);
}
Exemplo n.º 10
0
void VoxelBufferFilter::setup()
{
	GrayscaleFilter::setup();

	numCaptureFrames = 90;
	frameOffsetBytes = 0;
	capturedFrames = 0;

	volumeSize[0] = videoSize.x;
	volumeSize[1] = videoSize.y;
	volumeSize[2] = numCaptureFrames;

	addToggle("Capture", settings.do_capture);
	addSlider("Num. Capture Frames", numCaptureFrames, 1, 512);

	captureProgressSlider = &addSlider("Capture Progress", capturedFrames, 0, numCaptureFrames);

	h_volume = (unsigned char*)malloc(videoSize.x*videoSize.y*numCaptureFrames);

	enableKeyEvents();
}
Exemplo n.º 11
0
void ofxUIDropDownList::addToggles(vector<string>& toggleNames)
{
    for(unsigned int i = 0; i < toggleNames.size(); i++){
        addToggle(toggleNames[i]);
    }
}
Exemplo n.º 12
0
 void            addSeparator        (void)                                                                                      { addToggle(NULL, NULL, 0, false, "", "", NULL); }
Exemplo n.º 13
0
 void            addButton           (S32* target, S32 value, const String& key, const String& title, bool* dirtyNotify = NULL)  { FW_ASSERT(target); addToggle(NULL, target, value, true, key, title, dirtyNotify); }
Exemplo n.º 14
0
 void            addButton           (bool* target, const String& key, const String& title, bool* dirtyNotify = NULL)            { FW_ASSERT(target); addToggle(target, NULL, 0, true, key, title, dirtyNotify); }
Exemplo n.º 15
0
void ofxSimpleGuiToo::setup() {
	config			= &defaultSimpleGuiConfig;
	
	doSave			= false;
	changePage		= false;
	titleButton		= NULL;
	keyboardShortcutsEnabled = true;
	doDrawPageBoundary = false;
	
	headerPage		= &addPage("Header");
	headerPage->height = config->buttonHeight * 2;
	headerPage->width = 0;
	titleButton = &headerPage->addButton("title", changePage);
	headerPage->addToggle("Auto Save", doAutoSave);
	headerPage->addButton("Save Settings", doSave);
	headerPage->addFPSCounter();
	
	cols = ceilf(ofGetWidth() / config->gridSize.x);
	rows = ceilf(ofGetHeight() / config->gridSize.y);
	
	addPage(); // default settings page
	addFPSCounter();
	
	setAutoSave(true);
	setAlignRight(false);
	setDraw(false);
	
	
	//addToggle("", <#bool value#>)
	
	//addControl(*titleButton);
	
	page(1).addPageShortcut(addPage("Keyboard Shortcuts"));
	page(1).addPageShortcut(addPage("GUI"));
	//setPage("GUI");
	addButton("save settings", doSave);
	addToggle("auto save", doAutoSave);
	//gui.addTitle("gui display");

	gui.addTitle("controls");
	string choices[] = {"simple","advanced","all"};
	gui.addComboBox("display priority", ofxSimpleGuiPage::mainPriority, 3, choices);
	gui.addButton("collapse all", 't', this, &ofxSimpleGuiToo::closeAllTitles);
	gui.addButton("open all", 'T', this, &ofxSimpleGuiToo::openAllTitles);
	
	gui.addTitle("display mode");
	string displayModeChoices[GUI_MODE_COUNT] = {"fixed","floating"};
	addComboBox("display mode", displayMode, GUI_MODE_COUNT, displayModeChoices);
	gui.addTitle("floating parameters");
	gui.addSlider("x", displayRect.x, 0, ofGetWidth());
	gui.addSlider("y", displayRect.y, 0, ofGetHeight());
	gui.addSlider("columns", cols, 1, 10);
	gui.addSlider("rows", rows, 5, 30);
	gui.addButton("reset", this, &ofxSimpleGuiToo::setDefaultDimensions);
	gui.addToggle("draw boundaries", doDrawPageBoundary);
	//gui.addSlider("gui width", displayRect.width, 256, ofGetWidth());
	//gui.addSlider("gui height", displayRect.height, 256, ofGetHeight());

	setPage(1);
	
	//addSlider("advanced gui", ofxSimpleGuiControl::mainPriority, 0, 2);
	ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed);
}
Exemplo n.º 16
0
ofxWToggle & ofxWFrame::addGroupedToggle(const string & title, string group, string controlName, string _style){
	ofxWToggle & toggle = addToggle(title,controlName,style);
	groups[group].push_back(&toggle);
	ofAddListener(toggle.boolEvent,this,&ofxWFrame::groupedPressed);
	return toggle;
}
Exemplo n.º 17
0
//---------------------------------------------
guiTypeToggle * ofxControlPanel::addToggle(string name, bool defaultValue){
	return addToggle(name, "", defaultValue);
}