View Full Version : Corona Edge Mask
mf
24th February 2004, 20:33
Yet Another Slow and Useless Filter...
...That I had fun in making :D.
It's another kind of edge mask. I find it works pretty okay.
Download here (http://mf.creations.nl/avs/functions/CoronaEdgeMask-v0.1.avs)
Parallell thread (http://mf.onthanet.com/forum/thread.php?threadid=20&boardid=4&styleid=1&page=1#1).
FuPP
24th February 2004, 22:52
Tested (quickly though).
Looks good ! Two remarks :
I had to add levels(0,1.0,0,0,255) to see clearly the mask.
Edges are maybe not enough drawn (if I add inflate at the end, they are more clearly drawn, a little bit too much though :rolleyes: ).
A little bit slow maybe to be used in a complete filter chain, but really interesting ! :)
Best regards,
FuPP
mf
24th February 2004, 22:55
I didn't amplify anything because that can easily be left to the user. Currently the values range from 0 to 255 (or 16 - 235? how I HATE CCIR-601) so that should be fair enough. Afaik all edge masks are faint of themselves, and need adjusting later.
FuPP
24th February 2004, 23:03
ok, so sorry for that stupid remarks
FuPP
mf
24th February 2004, 23:08
Originally posted by FuPP
ok, so sorry for that stupid remarks
FuPP
Not stupid at all :).
Didée
25th February 2004, 09:56
Ah, THAT was the idea you mentioned. Edge detection without detecting edges ;)
And I was thinking'n'wondering about *what* you wanted to do with a mask, not about how to create one...
But wait a minute ...
{quote} Works only on Y {/}
No chroma processing - is that really you, mf? :)
- Didée
morsa
25th February 2004, 10:20
Can any of you explain to me the concept of detecting edges without border detection?
I'm interested about it....
mf
25th February 2004, 12:59
Originally posted by Didée
But wait a minute ...
{quote} Works only on Y {/}
No chroma processing - is that really you, mf? :)
Ever looked at mfToon (any version) ? At the very end it always goes MergeChroma(input) (or input.MergeLuma(dark), something like that, some users were having access violations on the mergechroma so I changed it to mergeluma). I really only made chroma processing in SharpTools cause XSharpen by itself doesn't process the chroma planes (or so the VDub filter behaved anyway). But hush, just use FitY2UV() and don't tell anyone you did such a shameful thing :D.
@morsa
Want me to make a version with comments about what it does exactly, every step?
morsa
25th February 2004, 13:48
Don-t know.You could send me a PM.
I want to know how is the process to detect borders that way, may be if you give me a complete description I could use that for a better resizer or code something useful, who knows anyway?....
mf
25th February 2004, 13:58
I'll just make a version with comments. My PM inbox is full anyway :D.
######
##
## Corona Edge Mask by mf
##
## Finds edges by creating coronas in the picture.
##
## Works only on Y.
##
## With comments for Morsa :)
function CoronaEdgeMask(clip input) {
##
## Enhance light picture elements.
input.Inflate().Inflate().Inflate().Inflate()
inflated = last
##
## Subtract to show the difference.
YV12Subtract(input, inflated).Greyscale()
dsubtracted = last
##
## Workaround a stupid bug in Subtract that inverts
## out-of-range values.
Overlay(dsubtracted, dsubtracted, mode="exclusion")
dinvertfix = last
##
## Amplify the image cause exclusion hurt it a bit.
Overlay(dinvertfix, dinvertfix, mode="darken")
## Make the mask range 0-255, instead of 0-127
Levels(0, 1.0, 127, 255, 0)
dmask = last
##
## Enhance dark picture elements
input.Deflate().Deflate().Deflate().Deflate()
deflated = last
##
## Subtract to show the difference.
YV12Subtract(deflated, input).Greyscale()
lsubtracted = last
##
## Workaround a stupid bug in Subtract that inverts
## out-of-range values.
Overlay(lsubtracted, lsubtracted, mode="exclusion")
linvertfix = last
##
## Amplify the image cause exclusion hurt it a bit.
Overlay(linvertfix, linvertfix, mode="darken")
## Make the mask range 0-255, instead of 0-127
Levels(0, 1.0, 127, 255, 0)
lmask = last
##
## Combine light and dark into a single mask containing
## both light and dark edges.
Overlay(dmask, lmask, mode="lighten").Greyscale()
}
Does this help you? :)
morsa
26th February 2004, 00:51
more or less, I'll have to study it....
What inflate and deflate does exactly?
mf
26th February 2004, 14:06
From the MaskTools manual:
- Inflate will 'inflate' the high values in a plane, by putting in the output plane either the average of the 8 neighbours if it's higher than the original value, otherwise the original value. The opposite function is called Deflate (dedicated to Phil Katz).
However, the algorithm has changed since MaskTools141. It seems undocumented what it exactly does mathematically, but it looks like it's just a softer (less square most importantly) version of the original algo. It would be nice if Kurosu could clarify :).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.