Esempio n. 1
0
void testApp::doGui(AudioEffect *e) {
	gui.clear();
	Parameters params;
	e->initParameters(params);
	for(int i = 0; i < params.params.size(); i++) {
		Parameter *p = params.params[i];
		if(p->type=="slider") {
			SliderParameter *s = (SliderParameter*)p;
			gui.addSlider(s->name, *s->value, s->min, s->max);
		} else if(p->type=="intslider") {
			IntSliderParameter *s = (IntSliderParameter*)p;
			gui.addSlider(s->name, *s->value, s->min, s->max);
		} else if(p->type=="meter") {
			MeterParameter *s = (MeterParameter*)p;
			gui.addMeter(s->name, *s->value);
			
		} else if(p->type=="toggle") {
			ToggleParameter *t = (ToggleParameter*)p;
			gui.addToggle(t->name, *t->value);
		} else if(p->type=="switch") {
			SwitchParameter *s = (SwitchParameter*)p;
			gui.addSegmented(s->name, *s->value, s->options);
		}
	}
}
Esempio n. 2
0
void Vision::setupGui(xmlgui::SimpleGui &gui) {
    gui.addToggle("draw tracker", drawTracker);
    gui.addToggle("flip horizontal", flipHorizontal);
    gui.addColorPicker("tracking colour", pickedColour);
    gui.addToggle("pick colour", pickColour);
    gui.addSlider("tracking threshold", threshold, 0,255);
}
Esempio n. 3
0
void tricks::vision::Camera::setup(int width, int height, string testVideoFile, string imagesFolder) {
	
	saveNextFrame = false;
	
	
#ifndef TEST_WITH_VIDEO
#ifdef _WIN32
	--
	firewire.setDeviceID(0);
	sdk = new FlyCaptureGrabber;
	sdk->listDevices();

	

#else
    Libdc1394Grabber *sdk = new Libdc1394Grabber;
	
	sdk->listDevices();
	sdk->setDiscardFrames(true);
	sdk->set1394bMode(false);
	char path[512];
	getcwd(path, 512);
	printf("Working directory: %s\n", ofToDataPath("", true).c_str());
	
#endif

	
	ofxIIDCSettings *settings = new ofxIIDCSettings;
	settings->setXMLFilename("mySettingsFile.xml");

	firewire.setVerbose(true);
	
#ifdef CAM_GREYSCALE
	bool result = firewire.initGrabber( width, height, VID_FORMAT_GREYSCALE, VID_FORMAT_GREYSCALE, 30, true, sdk, settings );
#else
	bool result = firewire.initGrabber( width, height, VID_FORMAT_YUV422, VID_FORMAT_RGB, 30, true, sdk, settings );
#endif
    canDoFirewire = result;

#ifdef _WIN32
	// setup the gui
	printf("Setted up gui\n");
	myGui.setup();
	myGui.addListener(this);
	
	int numProps = sdk->getNumProperties();
	for(int i = 0; i < numProps; i++) {
		string name;
		float value = 0;
		float min = 0;
		float max = 0;
		sdk->getPropertyInfo(i, name, value, min, max);
		float *f = new float;
		*f = value;
		printf("Value %f\n", value);
		//if(name=="BRIGHTNESS") max = 1024;
		myGui.addSlider(name, *f, min, max);
		cameraPropsIds[name] = i;
	}
#endif

	
#endif
	if(imagesFolder!="no-images") {
		this->imagesFolder = imagesFolder;
		imagePos = -1;
		nextImage();
	}
	canDoCamera = false;
#ifndef TEST_WITH_VIDEO
	if(result) {
		mode = CAMERA_MODE_FIREWIRE;
	} else if(videoGrabber.initGrabber(width, height)) {
		mode = CAMERA_MODE_QUICKTIME;
        canDoCamera = true;
	} else 
#endif
	{
		if(testVideoFile=="") {
			ofLogError("Video file path was empty, not gonna do a whole lot now");
		} else {
			printf("Trying to load %s\n", ofToDataPath(testVideoFile).c_str());
		}
		if(!testDataPlayer.loadMovie(testVideoFile)) {
			ofLogError("Couldn't load the movie, not gonna do shit now! %s", testVideoFile.c_str());
		}
		else {
			testDataPlayer.play();
			mode = CAMERA_MODE_RECORDED;
		}
	}
	
}