Morphological Image Processing?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

I need help conjuring an implementation for these algorithms:

1) Grayscale image erosion using flat circular structuring elements
2) Signed Euclidean distance transformation

Here is some research:

Morphological Image Processing

Efficient 2-D Grayscale Morphological Transformations With Arbitrary Flat Structuring Elements

Erosion, dilation and related operators

MORPHOLOGICAL STRUCTURING ELEMENT DECOMPOSITION: IMPLEMENTATION AND COMPARISON

Gray-Scale Structuring Element Decomposition

Euclidean Distance Mapping

Rapid Euclidean Distance Transform Using Grayscale Morphology Decomposition

Fast Euclidean Distance Transformation In Two Scans Using 3x3 Neighborhoods

Fast Euclidean Distance Transformation by Propagation Using Multiple Neighborhoods

FAST AND EXACT SIGNED EUCLIDEAN DISTANCE TRANSFORMATION WITH LINEAR COMPLEXITY

Anti-aliased Euclidean Distance Transform

These techniques perform the bulk of heavy lifting for "Layer Effects" (i.e. Photoshop Layer Styles). I need help with efficient implementations of these algorithms. Any information is welcome, including pointers to other references, help understanding which of these papers is appropriate, some implementation guidance for the techniques in the papers.

Thanks
Last edited by thevinn on Tue Jul 31, 2012 11:57 pm, edited 1 time in total.

Post

"Images are just two dimensional audio signals, right? "
i'm not sure if it's so simple (tho, maybe it can be viewed in different ways)

is it about single images, or frames (of a video) ?
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

antto wrote:is it about single images, or frames (of a video) ?
I'm trying to implement Layer Styles for JUCE Graphics contexts:

Image
Full Sized Image (opens in new window)

and here's the equivalent C++ code:

Image

This is for implementing nice looking controls for VST or workstation GUIs, using procedural code rather than a large collection of bitmap resources.

The dilate operator and the Euclidean distance transform are both essential building blocks for implementing Photoshop Layer Styles.
Last edited by thevinn on Tue Jul 31, 2012 11:54 pm, edited 2 times in total.

Post

Oh, and this is all MIT Licensed!!! Here's the repository:

https://github.com/vinniefalco/LayerEffects

( JUCE is still GPL / commercial)

If someone could work with me to implement the three "Fast / Rapid Euclidean" algorithms that would be great.

I believe there is tremendous value in bringing this project to the KVR developer community. When this works it will be possible to take a Photoshop PSD file with layers and associated Layer Styles, and write code (assuming you're using JUCE) which easily translates the settings on the layer styles into drawing commands.

This means no more embedding images of knobs in various positions into an application or DLL, instead you can draw these controls with full effects including all the transfer modes like lighten, darken, vivid light, etc... and get the flexibility and crisp output afforded to vector drawing.
Last edited by thevinn on Tue Jul 31, 2012 11:57 pm, edited 1 time in total.

Post

so i missunderstood the question, i thought it's about using audio FX on images or image FX on audio

you wanna use PhotoShop effects for "generating" GUIs?
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

antto wrote:so i missunderstood the question, i thought it's about using audio FX on images or image FX on audio
Yeah just ignore that.
you wanna use PhotoShop effects for "generating" GUIs?
Right, I would like to be able to specify in just a few lines of filling out some "options" structure, all of the features available in the Photoshop Layer Styles dialog. Then you just draw your control and the styles get applied.

For example, you could draw a rounded rectangle with a bunch of these layer styles computed at draw time, followed by a text label with some bevel and emboss, and then on top of that some "glow" layer style to create a hilited appearance.

All of this would happen with JUCE::Graphics calls like fillPath(), drawText(), and the filling out of some structures that I create.

So anything that you can draw: images, paths, text, lines, can all have Photoshop Layer Styles applied to it at draw-time, with no bitmaps stored in the app (except for Pattern images for Pattern Overlay).

Post

i feel dumb now, excuse me
neither do i use JUCE, nor do i know that "Euclidean" voodoo :?
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

antto wrote:nor do i know that "Euclidean" voodoo :?
Well that makes two of us...I find the research paper hard to read. So I was hoping some who speaks "math" could translate it.

Post

If you seriously want to do heavy-weight image processing on runtime, you should at least consider doing it in GPU shaders. Even then some of the stuff might be a bit excessive for anyone without serious gaming grade hardware.

Or are you planning to calculate it all at load time?

Post

mystran wrote:If you seriously want to do heavy-weight image processing on runtime, you should at least consider doing it in GPU shaders. Even then some of the stuff might be a bit excessive for anyone without serious gaming grade hardware.

Or are you planning to calculate it all at load time?
I'm going to do this all at runtime. I don't believe that the CPU impact is significant since this is for controls, which do not update frequently. You wouldn't want to put these layer styles onto a scrolling waveform or a level meter (which updates often).

GPU shaders are not really an option since this code requires a software renderer (to get at the pixels). Besides, that would be a maintenance nightmare.

Post

I started out in image processing and worked my way backwards to DSP!

:tu:

Seriously though, yes, they're much the same pursuit, sometimes. Though our ears are FAR less forgiving than our eyes!

Post

"Images are just two dimensional audio signals, right? "
i'm not sure if it's so simple (tho, maybe it can be viewed in different ways)
Frequency domain algorithms are similar in each case, but time domain algorithms are not, because they are solving different problems on different data.
~stratum~

Post

Prosoniq uses this technique in the morph plug-in. It basically mixes two sound sources the same way picture morphs are done this is stated on there website. http://www.prosoniq.com/audio-plugins/prosoniq-morph/
The sleeper must awaken.

Post

thevinn wrote: GPU shaders are not really an option since this code requires a software renderer (to get at the pixels).
Are you really sure? :roll:

Anyway I can kinda accept the part about maintenance. Just remember that even simple knobs or whatever might require at least around 10Hz update rate (to appear more or less smooth) when dragged by user or when being automated externally. Ofcourse you don't need to update everything at that rate, but it should still be realistic to update a few without stealing all the CPU for the purpose (and make sure you plan on dealing with "losing updates" gracefully).

Post

my video card sux, cuz i don't play games ;]
and btw, there are cases where all knobs on your plugin could be updating all the time (user automated all params) so.. have this in mind too
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post Reply

Return to “DSP and Plugin Development”