Bokeh Effect

anyone have a non-plugin (declare ok) version of an algorithm to apply this affect to a “picture”?

If I were to recommend that you familiarize yourself with the ImageMagick library, would that fall in or out of bounds of your request? The way you have limited things makes that very unclear.

Not sure why unclear.

a) Xojo Code - acceptable
b) Declares (Cocoa) acceptable
c) 3rd party plug-in NOT acceptable

So where do you slot ImageMagick in your taxonomy?

[quote=72930:@Dave S]Not sure why unclear.

a) Xojo Code - acceptable
b) Declares (Cocoa) acceptable
c) 3rd party plug-in NOT acceptable[/quote]

ImageMagik is an open source project you might be able to declare into without a plugin. Alternately you might be able to just translate an algorithm from it’s source code to Xojo (I assume it’s in C).

Brad said it the way he did because MBS does wrap it… But even without the plugin it is a place that you might find what you need.

[quote=72933:@Karen Atkocius]Brad said it the way he did because MBS does wrap it… But even without the plugin it is a place that you might find what you need.
[/quote]

If he were not restricting the discussion, we could have gotten there a lot quicker. But to be respectful to the OP, I think we need to establish whether this angle that he doesn’t seem to have considered is an acceptable line of discussion. Lest anyone decides a contribution is offensive and wants them banned… And of course, this will be a wonderfully useful discussion for the next person who searches for “Bokeh” on the forum.

Based on what I see… no where… MBS fails my criteria for reasons I have stated more times than I care to count.

It is NOT Xojo Code
It is not a Cocoa Declare
It doesn’t seem to be a plugin

It seems to be a “C” program or series of “C” modules… Plus there is no Bokeh algorithm that I could find referenced anywhere in the code.

So thanks for the attempt…

I’ll start another thread on this sometime. It’s an interesting topic if you don’t artificially limit your options. And you don’t need to “buy” anything to make this work.

P.S. The extension to your taxonomy that should make sense from your perspective is to allow free / OS libraries that you can declare into and ship in binary form with your app. Just an FYI…

May I ask a question?
Do you want the blur to be global or only on unfocused areas?

Nothing “artificial” about my restrictiions… this is how I do business…

I asked a specific question about a specific topic, with a set of criteria to allow answers that were acceptable to me…

So based on this drawn out topic… it ends with a simple “No, I am sorry there does not seem to be a solution that fits you requirements”

[quote=72942:@Dave S]I asked a specific question about a specific topic, with a set of criteria to allow answers that were acceptable to me…
[/quote]

Right. And by doing so you cut off lines of inquiry that might (well, would, as I know a little more than I’m letting on here) circuitously lead to a solution acceptable to you. Additionally, you created a discussion that will have zero value to anyone else. Bummer.

That must be hard to do in software.
As I understand it, its a physical effect caused by a long lens/short depth of field

Creating lens flare/ blur of light sources behind a sharp object

Blur/soft focus/ flare are all possible, but usually at the expense of the nice sharp edges of the subject matter.

If you could select the subject cleanly, you could apply blur to the image then paste the subject back on it.

Hard to see how it could be done as a digital effect, but I’d be happy to be proved wrong.

I have done this… but well i guess it doesn’t matter.

Jeff, see the 4th and 5th panels of effects in Apple’s PhotoBooth. Background detection and effects are very possible in software.

Take a look at this older Always Busy Corner blog. I’m not quite sure it is BOKEH but the technique looks like you can tweak it to get the desired effect

Look up the CoreImage filter CIDiscBlur, this will do a bokeh effect for you.

To avoid MBS, there will need to be a bucket load of declares written, but it’s more than possible.

I once tried to write a disc blur effect in Xojo, my lack of knowledge prevented me from getting anything useful (far too slow and far too crappy). The long and the short of it, you need to blur by using circles and forcing brighter colours forwards, while darker colors to go backwards.

The ‘tilt-shift’ effect uses a gradient blur to create pictures like this:

Pure Xojo code.

I like why you’ve done, very effective for the examples you posted. However generating bokeh, ain’t gonna cut. image interpolation can reproduce effects similar to blurring (done it before to gain speed), but it’s not doing a disc blur (which is what simulates bokeh).

I was intrigued.

I see that Photo Booth ‘cheats’ on this one, as it doesn’t actually ‘detect’ the background from a standing start. (and doesn’t do Bokeh either, at least on my copy)

Instead ,it asks you to step out of shot so that it can see what background IS, then put yourself back in the shot.
Now it has a clear idea what is background and what is not, so effects can be applied. Its working from 2 images, not one.

Bokeh effect on one image would need to guess which bits of the image are face (but remember it also needs to select hair accurately), or leaves, or a statue, as common subject examples
Then leaving that alone, blur the background only with a flare effect around highlight colours.

Alex van der Linden’s example above isn’t Bokeh, its a nice effect all the same, and more commonly used to make an image look like it was a ‘miniature’