PixelateFilter::PixelateFilter(float width, float height, float pixelRatio) : AbstractFilter(width, height) {
    _name = "Pixelate";
    _pixelRatio = pixelRatio;
    _addParameter(new ParameterF("fractionalWidthOfPixel", pixelRatio));
    _addParameter(new ParameterF("aspectRatio", getHeight()/getWidth() ));
    _setupShader();
}
SobelEdgeDetectionFilter::SobelEdgeDetectionFilter(float width, float height, float edgeStrength) : AbstractFilter(width, height) {
    _name = "Sobel Edge";
    _edgeStrength = edgeStrength;
    _addParameter(new ParameterF("edgeStrength", 1.f));
    _addParameter(new ParameterF("texelWidth", 1.f/getWidth()));
    _addParameter(new ParameterF("texelHeight", 1.f/getHeight()));
    _setupShader();
}
GaussianBlurFilter::GaussianBlurFilter(float width, float height, float blurSize, float bloom) :Abstract3x3PingPongFilter(width, height, ofVec2f(1, 1)) {
    _name = "Gaussian Blur";
    _blurSize = blurSize;
    _bloom = bloom;
    _addParameter(new ParameterF("blurSize", blurSize));
    _addParameter(new ParameterF("bloom", bloom));
    _setupShader();
}
Example #4
0
	DummyDynamicInputModule(const std::string& name = "") :
		ParameteredObject("DummyDynamicInputModule", name,
			"dummy dynamic input module") {

		_addInputSlot(in1, "in1", "input slot 1");
		_addParameter(param1, "parameters", "Number of Parameters", 2);
		_addParameter(param2, "length", "Number of Slots", 1);
		_setDynamic(true);
	}
MotionDetectionFilter::MotionDetectionFilter(ofTexture & texture, float intensity, bool showImage) : AbstractTwoInputFilter(texture.getWidth(), texture.getHeight()) {
    _name = "Motion Detection";
    _texture = texture;
    _lowPassFilter = new LowPassFilter(getWidth(), getHeight(), 0.6);
    setSecondTexture(_lowPassFilter->getTextureReference());
    _addParameter(new ParameterF("intensity", intensity));
    _addParameter(new ParameterF("showImage", (float)showImage));
    _setupShader();
}
Example #6
0
SwirlFilter::SwirlFilter(float width, float height, float radius, float angle, ofVec2f center) : AbstractFilter(width, height) {
    _name = "Swirl";
	_radius = radius;
	_angle = angle;
	_center = center;
    _addParameter(new ParameterF("radius", radius));
    _addParameter(new ParameterF("angle", angle));
	_addParameter(new Parameter2f("center", center));
    _setupShader();
}
Example #7
0
ToonFilter::ToonFilter(float width, float height, float threshold, float quantizationLevels) : AbstractFilter(width, height) {
    _name = "Toon";
    _threshold = threshold;
    _quantizationLevels = quantizationLevels;
    _addParameter(new ParameterF("texelWidth", 1.f/getWidth()));
    _addParameter(new ParameterF("texelHeight", 1.f/getHeight()));
    _addParameter(new ParameterF("threshold", _threshold));
    _addParameter(new ParameterF("quantizationLevels", _quantizationLevels));
    _setupShader();
}
ParameteredGroupObject::ParameteredGroupObject(const std::string &className, const std::string &name, const std::string &doc)
	:ParameteredObject(className,name,doc)
{
	_addParameter(pluginPaths,"pluginPaths","The paths where the plugins are stored.","string");
	_addParameter<bool>(debugSuffix,"debugSuffix","Load debug plugins suffixed with '_d'",1);
	_addParameter(workFlowFile,"workflowfile","The workflow contained in this group","FileOpen");
	_pluginMan=0;
	_inputs=0;
	_outputs=0;
	_setDynamic(true);
}
TiltShiftFilter::TiltShiftFilter(ofTexture & texture, float focusPercent, float falloff) : AbstractFilter(texture.getWidth(), texture.getHeight()) {
    _name = "Tilt Shift";
    _texture = texture;
    _focusPercent=ofClamp(focusPercent, 0, 1);
    _gaussianBlurFilter = new GaussianBlurFilter(getWidth(), getHeight());
    _addParameter(new ParameterF("topFocusLevel", focusPercent));
    _addParameter(new ParameterF("bottomFocusLevel", 1.f - focusPercent));
    _addParameter(new ParameterF("focusFallOffRate", falloff));
    _addParameter(new ParameterT("inputImageTexture", _texture, 1));
    _addParameter(new ParameterT("inputImageTexture2", _gaussianBlurFilter->getTextureReference(), 2));
    _setupShader();
}
Example #10
0
	virtual void prepareDynamicInterface(const ParameterFile& file) {
		param2.load(file);
		if (param2() >= 2) {
			_addInputSlot(in2, "in2", "input slot 2");
		}
		param1.load(file);
		if (param1() >= 3) {
			_addParameter(param3, "param3", "parameter 3", 0);
		}
		if (param1() >= 4) {
			_addParameter(param4, "param4", "parameter 4", 0);
		}
	}
VoronoiFilter::VoronoiFilter(ofTexture & texture) : AbstractFilter(texture.getWidth(), texture.getHeight()) {
    _name = "Voronoi";
    _texture = texture;
    for (int i=0; i<NUM_POINTS; i++) {
        _vertices[i*2] = ofRandomuf();
        _vertices[i*2+1] = ofRandomuf();
        _colors[i*3] = ofRandomuf();
        _colors[i*3+1] = ofRandomuf();
        _colors[i*3+2] = ofRandomuf();
    }
    _addParameter(new Parameter2fv("verts", _vertices, NUM_POINTS));
    _addParameter(new Parameter3fv("colors", _colors, NUM_POINTS));
    _setupShader();
}
DoGFilter::DoGFilter(float width, float height, float black, float sigma, float sigma3, float tau, int halfWidth, int smoothPasses, ofVec2f sketchiness) : AbstractFilter(width, height) {
    _name = "Difference of Gradient";
    _imageFbo.allocate(getWidth(), getHeight(), GL_RGBA32F_ARB);
    _edgeTangentFbo.allocate(getWidth(), getHeight(), GL_RGBA32F_ARB);
    _directionalFbo.allocate(getWidth(), getHeight(), GL_RGBA32F_ARB);
    _imageFbo.begin();
    ofClear(0, 0, 0, 0);
    _imageFbo.end();
    _edgeTangentFbo.begin();
    ofClear(0, 0, 0, 0);
    _edgeTangentFbo.end();
    _directionalFbo.begin();
    ofClear(0, 0, 0, 0);
    _directionalFbo.end();
    
    _edgeTangentFilters = new FilterChain(getWidth(), getHeight(), "edgeTangentFilters", GL_RGBA32F_ARB);
    _edgeTangentFilters->addFilter(new EdgeTangentFilter(getWidth(), getHeight()));

    for (int i=0; i<smoothPasses; i++) {
        _edgeTangentFilters->addFilter(new EdgeTangentSmoothingFilter(getWidth(), getHeight(), ofVec2f(2.0, 0.0), halfWidth));
        _edgeTangentFilters->addFilter(new EdgeTangentSmoothingFilter(getWidth(), getHeight(), ofVec2f(0.0, 2.0), halfWidth));
    }
    
    _directionalDoGFilter = new DirectionalDoGFilter(getWidth(), getHeight(), sigma, tau, sketchiness.x, sketchiness.y);
    _flowDoGFilter = new FlowDoGFilter(getWidth(), getHeight(), sigma3);
    _addParameter(new ParameterF("black", black));
    _setupShader();
}
RemoveDimensionsFilter::RemoveDimensionsFilter(float width, float height) : AbstractFilter() {
    _name = "RemoveDimensions";
    _i_xMin = 0;
    _i_xMax = width;
    _i_yMin = 0;
    _i_yMax = height;


    _addParameter(new ParameterI("i_xMin", _i_xMin));
    _addParameter(new ParameterI("i_xMax", _i_xMax));
    _addParameter(new ParameterI("i_yMin", _i_yMin));
    _addParameter(new ParameterI("i_yMax", _i_yMax));
    _setupShader();

    ofLogVerbose("[RemoveDimensionsFilter:: constructor] end");
}
CrosshatchFilter::CrosshatchFilter(float width, float height, float crosshatchSpacing, float lineWidth) : AbstractFilter(width, height) {
    if (crosshatchSpacing<1.f/getWidth()) crosshatchSpacing = 1.f/getWidth();
    _addParameter(new ParameterF("crosshatchSpacing", crosshatchSpacing));
    _addParameter(new ParameterF("lineWidth", lineWidth));
    _setupShader();
}
void ParameteredGroupObject::initialize()
{
	ParameteredObject::initialize();

	if(_inputs)
	{
		std::vector<VirtualInputSlot*> vinput=_inputs->getSlotVector();
		for(size_t i=0;i<vinput.size();i++)
		{
			VirtualInputSlot* in=vinput[i];
			_removeInputSlot(in->getName());
			Parameter<int> *par=_loopOutputNumber[i];
			_removeSomething("parameters",par->getName());
			delete par;
			breakLoop(i);
		}
	}
	_loopOutputNumber.clear();

	if(_outputs)
	{
		std::vector<VirtualOutputSlot*> voutput=_outputs->getSlotVector();
		for(size_t i=0;i<voutput.size();i++)
		{
			VirtualOutputSlot* out=voutput[i];
			_removeOutputSlot(out->getName());
		}
	}

	_inputs=0;
	_outputs=0;
	if (_pluginMan!=0) {
		_pluginMan->reset();
		delete _pluginMan;
		_pluginMan = 0;
	}

	_pluginMan = new PluginManager(pluginPaths(),debugSuffix());
	_pluginMan->loadParameterFile(workFlowFile());
	const std::map<std::string, ParameteredObject*>& objs=_pluginMan->getObjectList();

	std::map<std::string, ParameteredObject *>::const_iterator it=objs.begin();
	for(;it!=objs.end();it++)
	{
		ParameteredObject* obj=it->second;
		InputSlotBundleIntf* tinputs=dynamic_cast<InputSlotBundleIntf*>(obj);
		OutputSlotBundleIntf* toutputs=dynamic_cast<OutputSlotBundleIntf*>(obj);
		if(tinputs)
			_inputs=tinputs;
		if(toutputs)
			_outputs=toutputs;
	}

	if(_inputs)
	{
		std::vector<VirtualInputSlot*> vinput=_inputs->getSlotVector();
		for(size_t i=0;i<vinput.size();i++)
		{
			VirtualInputSlot* in=vinput[i];
            onAddInputSlot(in);
			Parameter<int> *par=new Parameter<int>(-1);
			std::stringstream pname;
			pname<<"loop_input_"<<i<<"_to_output";
			std::stringstream pdoc;
			pdoc<<"The input "<<i<<" gets the data of the given output after one iteration of a loop. To disable the connection, set to -1";
			_addParameter(*par,pname.str(),pdoc.str(),"int");
			_loopOutputNumber.push_back(par);
		}
	}
	if(_outputs)
	{
		std::vector<VirtualOutputSlot*> voutput=_outputs->getSlotVector();
		for(size_t i=0;i<voutput.size();i++)
		{
			VirtualOutputSlot* out=voutput[i];
            onAddOutputSlot(out);
		}
	}

	initializeGroup();

	#pragma message ("need to load slotbundle connections")
	//_inputs->loadConnection(ParameterFile(workFlowFile),_pluginMan);
	//_outputs->loadConnection(ParameterFile(workFlowFile),_pluginMan);
}
AbstractTwoInputFilter::AbstractTwoInputFilter(float width, float height) : AbstractFilter(width, height) {
    _secondTexture.allocate(getWidth(), getHeight(), GL_RGB16);
    _addParameter(new ParameterT("inputImageTexture2", _secondTexture, 1));
}
ZoomBlurFilter::ZoomBlurFilter(float blurSize) : AbstractFilter(0, 0) {
    _name = "Zoom Blur";
    _addParameter(new Parameter2f("blurCenter", ofVec2f(0.5, 0.5)));
    _addParameter(new ParameterF("blurSize", blurSize ));
    _setupShader();
}
CornerDetectionFilter::CornerDetectionFilter(float width, float height, float sensitivity) : AbstractFilter(width, height) {
    _name = "Corner Detection";
    _addParameter(new ParameterF("sensitivity", sensitivity));
    _setupShader();
}
DissolveBlendFilter::DissolveBlendFilter(float width, float height, float mix) : AbstractTwoInputFilter(width, height) {
    _name = "Dissolve Blend";
    _addParameter(new ParameterF("mixturePercent", mix));
    setMix(mix);
    _setupShader();
}
BilateralFilter::BilateralFilter(float width, float height, float blurOffset, float normalization) : Abstract3x3PingPongFilter(width, height, ofVec2f(blurOffset, blurOffset)) {
    _name = "Bilateral";
    _normalization = normalization;
    _addParameter(new ParameterF("distanceNormalizationFactor", normalization));
    _setupShader();
}
KuwaharaFilter::KuwaharaFilter(int radius) : AbstractFilter(0, 0) {
    _name = "Kuwahara";
    _radius = radius;
    _addParameter(new ParameterI("radius", _radius));
    _setupShader();
}
BrightnessFilter::BrightnessFilter(float brightness) : AbstractFilter(0,0){
    _addParameter(new ParameterF("brightness", brightness));
    _setupShader();
}