Morphological Image Processing?
- KVRian
- 775 posts since 30 Nov, 2008
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
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.
My Open Source:
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
- KVRAF
- 2569 posts since 4 Sep, 2006 from 127.0.0.1
"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) ?
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
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr
- KVRian
- Topic Starter
- 775 posts since 30 Nov, 2008
I'm trying to implement Layer Styles for JUCE Graphics contexts:antto wrote:is it about single images, or frames (of a video) ?

Full Sized Image (opens in new window)
and here's the equivalent C++ code:

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.
My Open Source:
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
- KVRian
- Topic Starter
- 775 posts since 30 Nov, 2008
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.
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.
My Open Source:
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
- KVRAF
- 2569 posts since 4 Sep, 2006 from 127.0.0.1
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?
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
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr
- KVRian
- Topic Starter
- 775 posts since 30 Nov, 2008
Yeah just ignore that.antto wrote:so i missunderstood the question, i thought it's about using audio FX on images or image FX on audio
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.you wanna use PhotoShop effects for "generating" GUIs?
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).
My Open Source:
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
- KVRAF
- 2569 posts since 4 Sep, 2006 from 127.0.0.1
i feel dumb now, excuse me
neither do i use JUCE, nor do i know that "Euclidean" voodoo
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
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr
- KVRian
- Topic Starter
- 775 posts since 30 Nov, 2008
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.antto wrote:nor do i know that "Euclidean" voodoo
My Open Source:
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
- KVRAF
- 8484 posts since 12 Feb, 2006 from Helsinki, Finland
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?
Or are you planning to calculate it all at load time?
- KVRian
- Topic Starter
- 775 posts since 30 Nov, 2008
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).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?
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.
My Open Source:
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
Beast, rippled, DSPFilters, LayerEffects, SimpleDJ
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
I started out in image processing and worked my way backwards to DSP!

Seriously though, yes, they're much the same pursuit, sometimes. Though our ears are FAR less forgiving than our eyes!
Seriously though, yes, they're much the same pursuit, sometimes. Though our ears are FAR less forgiving than our eyes!
-
- KVRAF
- 2256 posts since 29 May, 2012
Frequency domain algorithms are similar in each case, but time domain algorithms are not, because they are solving different problems on different data."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)
~stratum~
-
David Carpenter Wind Core David Carpenter Wind Core https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=196097
- KVRist
- 223 posts since 17 Dec, 2008 from Boulder CO
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.
- KVRAF
- 8484 posts since 12 Feb, 2006 from Helsinki, Finland
Are you really sure?thevinn wrote: GPU shaders are not really an option since this code requires a software renderer (to get at the pixels).
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).
- KVRAF
- 2569 posts since 4 Sep, 2006 from 127.0.0.1
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
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
..as long as it has BASS and it's LOUD!
irc.libera.chat >>> #kvr

