GithubHelp home page GithubHelp logo

lingdong- / ofxpoissonfill Goto Github PK

View Code? Open in Web Editor NEW
56.0 3.0 3.0 167 KB

Poisson filling shader for OpenFrameworks

License: MIT License

Makefile 39.21% C++ 60.79%
poisson-editing glsl openframeworks-addon shader

ofxpoissonfill's Introduction

ofxaddons_thumbnail

ofxPoissonFill

Poisson filling shader for OpenFrameworks

  • Uses GLSL shader
  • Uses convolution pyramid algorithm
  • Fast
  • Header-only

Snip20200511_9

Installation

Drop the folder into OF_ROOT/addons. Done!

Or even simpler, copy paste src/ofxPoissonFill.hpp directly to your own src folder.

Usage

PoissonFill pf;

ofTexture tex; 

// prepare your image here...

// allocate necessary datastructures (once)
pf.init(tex.getWidth(), tex.getHeight());

// process the image
pf.process(tex);

// draw processed image
pf.getTexture().draw(0,0);

See also example, API Documentation

Reference

Developed at Frank-Ratchye STUDIO for Creative Inquiry at Carnegie Mellon University.

ofxpoissonfill's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ofxpoissonfill's Issues

does it work for non power of two texture sizes?

Thanks for this great addon!
I've noticed it sometimes cause an offset of the original image if using arbitrary texture sizes, like 1920x1080
and using power of two textures, like 512 x 512 the effect mantains the alignment with the original scene.
is it possible to use different texture values?
Thank you

Branching in the Shader

Hi there! Thanks for making this addon. I was working on porting it to SparkAR but I noticed there is quite a lot of branching in the shader, especially with the G and h1 functions. Apologies for the unsolicited issues, but I wonder if you might increase performance by using arrays instead of the branching if statements.

  float h1[5] = {0.1507, 0.6836, 1.0334, 0.6836, 0.1507};
  float G[3] = {0.0312, 0.7753, 0.0312};

And then later on, you can also simplify this calculation be only calculating the weight once:

float weight = h1[dx + 2] * h1[dy + 2];
acc += col * weight;

The last parts of each section of the shader could remove the check for if acc.a == 0.0 to also read something like:

float mask = step(0.00001, acc.a);
fragColor= vec4(acc.rgb / acc.a, 1.0) * mask + acc * (1.0-mask);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.