High-quality replacements for CoreImage filters


#1

As I’ve posted here in the past, previous code I have used that applies OSX Core Image filters to a texture-based FBO stopped working after OS 10.9.
[ ofFBO and Core Image Filters Fix Sought ]

Having spent close to 100 hours trying to solve this, I think I need to throw in the towel and find a replacement.

I was using the gorgeous and fast CI Gaussian Blur filter, with an Affine Clamp applied – getting very smooth blurs even with very large blur radius (even as high as 50 pixels). I was also applying CI Saturation, Brightness, and Contrast and CI add-compositing that onto the gaussian blur.

I need to replace these. What I have discovered in cursory look a GLSL options is that there are a lot of poor quality blurs out there. Any suggestions where to look for replacements that might have similar quality and speed to Core Image? Anything that might speed up my search.

Just tried the FreeFrame plugin extension for OF, but it appears to need updating.

Crossing fingers…


#2

Personally I have only used OpenCV as a standalone package without Openframeworks but I think
ofxOpenCV can do the job you require.
Hope this helps.

Cheers,
Manish


#3

Maybe you can take a shortcut with this:

It lets you load shaders from https://www.shadertoy.com/ into openframeworks. There are a lot of amazing things that people share there. You will have a bit of figuring out how to transfer them, but there is a lot of great stuff there. Here is a link to some blur stuff:

https://www.shadertoy.com/results?query=blur&sort=popular&from=12&num=12


#4

Hi, although I made this with a different purpose, it has a shader based gaussian blur, which can accept any radius and it is quite fast. I am almost certain that it is mathematically correct.
hoope this helps


#5

Thanks very much, Roy. I’ve downloaded and compiled test 4 and 5 in of 0.10 (I did have to run the OF Updater on the projects, as you note in your instructions). Oddly, if ‘show blurred’ is checked in the GUI, no image is displayed – on my Mojave machine (10.14.2). When I move it to an OS 10.11 machine, it works fine and looks great!. Unhelpfully, no unusual error messages are showing up in Console on Mojave.


#6

Also just tested in OF 10.1. Same problem of blurred image not appearing on Mojave machine.


#7

hi. thats odd. Damn Mojave. :neutral_face:
Can you run the in mojave any of the shaders examples?
what happens when you deactivate “Process Gamma” in the gui?
Does it only happen with the test5 or is it also happening with test4?

Maybe mojave is picky about the read pixels function.
I dont use mojave so I cant test by myself.
if you modify test4 and put the following in the ofApp::draw() , what happens?

void ofApp::draw(){
	fboX.begin();
	
	shader.begin();
	shader.setUniform2f("direction", 1, 0);
	
	testPattern.draw(0, 0);
	
	shader.end();
	
	fboX.end();
	
	//----------------------------------------------------------
	fboY.begin();
	
	shader.begin();
	shader.setUniform2f("direction", 0, 1);
	
	fboX.draw(0, 0);
	
	shader.end();
	
	fboY.end();
	
	fboY.draw(0,0);

	gui.draw();
}

#8

Same problem occurs in test 4 and 5, regardless of gamma checkbox.
Substituting the code you provided into test 4 does not change the behavior.
Yes, Mojave seems to be creating more than its fair share of difficulties!


#9

Also have confirmed that the OF shader examples all run on my Mojave machine. Hmmm.


#10

can you put inside setup()

ofSetLogLevel(OF_LOG_VERBOSE);

and run the test4. now the console should print if there’s anything wrong with teh shader.


#11

Actually, just found a fix, though not necessarily an explanation. I noted that the fboX blur was successful and could be drawn. It was only in the followup fboY that the result just ended up grey, regardless of what I drew into fboX and regardless of whether shaders were active. The problem was not with the shader. Gradually, that let me to:

In the fboY draw process, insert ofClear(0) before fboX.draw(0, 0);

Now works! (And looks great.)


#12

Please forgive my ignorance, but in trying to integrate this into my own project, I find myself very puzzled by the ‘shared code’ aspect of this project, and its gamma_tests.h file. I assume there is is some easier way to me to setup my project (I want my project setup to be as simple as possible). But it is not clear to me how to include gamma_test.h directly in my project… or, for that matter, why it isn’t implemented as a standard cpp file.


#13

it is because it is shared with all the other tests I was doing. That way I dont copypaste code and everything is a lot cleaner. If you just want to use it in your project you can move gamma_test.h into your project’s src folder and that would be all you need to do. (and update the project with project generator.

On the other end of things, what I was doing is to use the shared_code folder as a local addon, which is specified in the project’s addons.make file, which has teh following line

../shared_code

Which tells project generator to include the shared_code folder as if it was an addon