Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th August 2015, 17:50   #1  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Which blur to use for Local Contrast Enhancement?

On the one hand,
Code:
#Unsharpen (it will sharpen the image)

function unsharpen(clip c,float variance,float k)
{
   blr=gaussianblur(c,vary=variance,varc=2,Y=3,U=2,V=2,border=1)
   return yv12lutxy(blr,c,"y x - "+string(k)+" * y +",y=3,u=2,v=2)
}
from VariableBlur.txt uses GaussianBlur() (comparing results with the VariableBlur unsharp() plugin function, it seems that uses Gaussian blur too). On the other hand, in contrast enhancement discussions elsewhere on this forum MedianBlur() is mentioned and used.

Using this radius-variance relationship to provide similar settings for comparing MedianBlur() and GaussianBlur() LCE outputs with the function
Code:
function unsharpenmod(clip c, float "variance", float "strength", bool "chroma", string "blurfn") {
    variance = Default(variance, 128.0     )
    strength = Default(strength,   0.2     )
    chroma   = Default(chroma  , true      )
    blurfn   = Default(blurfn  , "gaussian")
    vbU      = chroma ? 3 : 1
    vbV      = vbU
    radiusY  = Round(Sqrt(variance)*Sqrt(Log(255)/Log(2)) - 1)
    radiusU  = chroma ? radiusY : -256
    radiusV  = radiusU
    mtU      = chroma ? 3 : 4
    mtV      = mtU
    blurfn   = blurfn == "gaussian" ? \
                    "gaussianblur(c, varY=" + String(variance) + ", varC=" + String(variance) + ", Y=3, U=" + String(vbU) + ", V=" + String(vbV) + ")" : \
               blurfn == "median"   ? \
                    "Medianblur(c, radiusY=" + String(radiusY) + ", radiusU=" + String(radiusU) + ", radiusV=" + String(radiusV) + ")" : \
               """Assert(false, "unsharpenmod: Invalid blur function")"""
    blr      = Eval(blurfn)
    return mt_lutxy(blr, c, "y x - " + string(strength) + " * y +", y=3, u=mtU, v=mtV)
}
seems to indicate (see screenshots in attachments):
  • MedianBlur LCE creates less overshoot along edges (e.g. GaussianBlur lightening the sky around (951, 460))
  • MedianBlur LCE seems more prone to growing lighter areas (e.g. the light grey around (235, 400) being replaced with white)
  • GaussianBlur LCE enhances areas of low contrast better (e.g. the mountain range either side of (360, 360))
  • MedianBlur LCE enhances areas of higher contrast better (e.g. the mountain area around (1044, 555))
(All the above with chroma processing enabled, merely because the video I'm working on benefits from it.)

Is that assessment correct and complete (at least for chroma-enabled cases)? If not, what improvements are necessary?

What kind of blur is normally preferred for Local Contrast Enhancement, and why?

Thanks,
François

EDIT: Despite the text "Attachments Pending Approval", they are already clickable.
Attached Images
   

Last edited by fvisagie; 7th August 2015 at 17:52. Reason: Attachment status
fvisagie is offline   Reply With Quote
Old 8th August 2015, 00:23   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Have you read the "Local Contrast Enhancement" thread?

Quote:
Originally Posted by fvisagie View Post
EDIT: Despite the text "Attachments Pending Approval", they are already clickable.
Not clickable here...
Reel.Deel is offline   Reply With Quote
Old 8th August 2015, 11:25   #3  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Quote:
Originally Posted by Reel.Deel View Post
Have you read the "Local Contrast Enhancement" thread?
I did do my homework . I didn't see these questions addressed there, at least not specifically enough to prevent me missing them.

Quote:
Not clickable here...
Sorry about that. I uploaded .PNGs, which were then auto-converted to .JPGs and needed approval. Previously I was able to post .PNGs as is and they also didn't need approval.
fvisagie is offline   Reply With Quote
Old 15th August 2015, 16:47   #4  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
This won't answer your questions but here's a video that I came across yesterday: Local contrast enhancement: gaussian vs. bilateral blurring
Reel.Deel is offline   Reply With Quote
Old 17th August 2015, 13:05   #5  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Thoughtfullness still appreciated.
fvisagie is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:02.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.