Sharpen: Exclude contours that are sharp already?

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Hardy-

  • Posts: 222
  • Joined: Sun Jun 19, 2022 4:39 am
  • Real Name: Hardy Heinlin

Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 5:29 am

Hello,

as we know, we can set a threshold below which blurry contours remain blurry, and above which sharp contours get sharper.

Is there a method in Resolve that provides two thresholds?


C: Very sharp video material: Do not sharpen this

---- Threshold 2 ---- (my wish)

B: Slightly unsharp video material that needs to be sharpened

---- Threshold 1 ---- (the usual one)

A: Blurry video material: Do not sharpen this
Offline

Peter Cave

  • Posts: 3894
  • Joined: Thu Aug 23, 2012 6:45 am
  • Location: Melbourne, Australia

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 7:41 am

Which sharpen tools are you using?
Resolve 19.0 b3 Mac OSX 14.5 Sonoma
Mac Studio Max 32GB
Offline

Hardy-

  • Posts: 222
  • Joined: Sun Jun 19, 2022 4:39 am
  • Real Name: Hardy Heinlin

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 10:42 am

I'm open to any method. I guess it can be done in Fusion, but maybe also on the Color page with certain node trees and alpha mask nodes.

I've been using the "Blur - Sharpen" tool on the Color page, in the lower center panel, with these settings:

Radius: 0.48
H/V Ratio: 0.50
Scaling: 0.25
Coring Softness: 2.00
Level: 7.00
All RGB channels linked
Color Space in this specific node: Lab (CIE)

I think this node alone cannot separate the already sharp areas.

I guess it requires a complex node sequence with at least two different alpha mask nodes:
1. Mask created with a higher sharpening threshold
2. Mask created with a lower sharpening threshold
Then one mask inverted and mixed at 50% transparency with the second mask, so that their non-common gray scale pixels eliminate each other, i.e. the ultra sharp areas disappear from the mixed mask.

I'm no expert. Maybe there's a special method?
Offline
User avatar

KrunoSmithy

  • Posts: 340
  • Joined: Fri Oct 20, 2023 11:01 pm
  • Real Name: Kruno Stifter

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 11:17 am

Hardy- wrote:Hello,

as we know, we can set a threshold below which blurry contours remain blurry, and above which sharp contours get sharper.

Is there a method in Resolve that provides two thresholds?


C: Very sharp video material: Do not sharpen this

---- Threshold 2 ---- (my wish)

B: Slightly unsharp video material that needs to be sharpened

---- Threshold 1 ---- (the usual one)

A: Blurry video material: Do not sharpen this


Well, you have to specify which footage and or counters, or edges need to be changed before you try to change them with some tool. This selection process either has to be done manually by user or by some kind of specially trained AI method. To my knowlage, other than very simple luminescence values there is no real contextual way to do it, other than manually selecting specific footage for specific processing or by use of trained AI.

Samurai tool for Digital Anarchy, a third party sharpening plug in is not AI , but has the ability to use edge masks based on luminescence values. Meaning, much like so called smart sharpen tool in Photoshop it can not sharpening the highlights on edges and do instead only work on shadows, or the other way around. But this is pretty basic and broad for precise selection.

Another method could be with use of frequency separation based on details. There are some tools that can do that, but its probably not best for what you want. They can be effective sharpening tools, but require careful use, not a batch processing tool.

Bryan Ray did a tutorial a while back DeSharpen for Fusion to deal with white edge nasty halos from compressed and processed footage when preparing them for green screen keying.

https://bryanray.name/2018/06/18/desharpen-for-fusion/

Again, manual process and involves a lot of work.

Maybe there is some clever way in Fusion to set up what you want, but I'm not sure... maybe some scripting and expressions would be needed. I haven't tried it with stock tool.

But I suppose the problem is even if you use frequency separation to apply or not apply additional sharping based on details , there is no way, outside of manual intervention or AI training to know any context of the image. Because sometimes you may want sharp edges, but not sharp skin details, or you want more skin texture but not contours on the edges.

There are some really good sharpening tools I use that come as DCTL's, but they can't really do what you ask. Interesting challenge. if you manually select clips and footage and you know what you want, than its doable, if you on the other hand require batch auto processing than its a different problem altogether. And even AI can be unreliable. And slow.

For example. Topaz Video AI has feature to auto sharpen or not with bunch of parameters the video footage and I think it tries to either do one time estimation per clip, frame by frame or offers suggestion for manual settings. Great. Problem is that its not very reliable. So sometimes you get what you want, and sometimes you don't get what you want, and human judgment is very much needed on clip by clip basis if you want to do it right.

While not perfect, usually my go to sharpening tool in Fusion and Resolve is this.

The following fuse is based on the Contrast Adaptive Sharpening algorithm of the AMD FidelityFX project for developers.

CAS adjusts the amount of sharpening per pixel to target an even level of sharpness across the image. Areas of the input image that are already sharp are sharpened less, while areas that lack detail are sharpened more. This allows for higher overall natural visual sharpness with fewer artifacts.

https://gpuopen.com/fidelityfx-cas/

"As I wanted the code to be based on Quality instead of Performance, I applied a contrast detection based on Rec709 Luminance instead of just focusing on the green channel. You can also change the color sliders in case of sharpening should be weighed differently. Furthermore, the original algorithm scans the left/right and top/down neighbors. I also included the diagonal neighbor pixels for better quality. The area of neighborhood pixels can be extended by the Shift control to sharpen lower frequencies but that might lead to color artifacts if pushed too far. "

https://www.steakunderwater.com/wesuckl ... php?t=6107

Honeyview_CAS.jpg
Honeyview_CAS.jpg (366.54 KiB) Viewed 305 times


...................

P.S. If you use it with compressed footage, on higher settings it will also sharping chroma and artifacts will be shown. Pro tip. Use blend mode of luminosity to limit the sharpening only the to luminosity not color where you run a risk of making those nasty compression artifacts really viable.

If you use it in Fusion make sure your DCTL node is use with merge node, since merge node offers blend modes. And in newer version of Resolve in the color page, you can right click on any node now and chose composting mode or blending mode of luminosity .

Also in fusion there are other methods that can be used to take it even further, but basic set up usually works well.
Offline

Mike Manus

  • Posts: 131
  • Joined: Sun Jan 21, 2018 5:51 am

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 11:46 am

Here's a thread from liftgammagain about a frequency separation power grade. It's been a long time since I looked at it, but if I remember correctly it only separates the image into two areas, low frequency and high.

But I think it would be possible to tailor it to have three areas. But like I said, it's been a while.


https://www.liftgammagain.com/forum/ind ... olve.2983/
Offline

Hendrik Proosa

  • Posts: 3125
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 12:27 pm

Simplest dumbest way would be to first create some kind of sharpness quantifying element, for example by taking a slightly blurred high-freq map (difference of original and blurred) and thresholding it as desired (separate medium detail areas between the two user-controlled thresholds). Then use the map as mask for mixing the original and sharpened image.
I do stuff
Offline
User avatar

KrunoSmithy

  • Posts: 340
  • Joined: Fri Oct 20, 2023 11:01 pm
  • Real Name: Kruno Stifter

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 12:29 pm

Mike Manus wrote:Here's a thread from liftgammagain about a frequency separation power grade. It's been a long time since I looked at it, but if I remember correctly it only separates the image into two areas, low frequency and high.

But I think it would be possible to tailor it to have three areas. But like I said, it's been a while.


https://www.liftgammagain.com/forum/ind ... olve.2983/


For sharpening using Frequency Separation there is actually one potentially useful Fuse or DCTL called....

MTF Curve DCTL

https://github.com/thatcherfreeman/utility-dctls

Gives you control over a MTF-like curve. Internally makes passes of different frequencies which can be increased or reduced in gain before combining them back together. Highly recommend using the Quotient method and feeding this DCTL a log image.
DCTL Parameters

Band 16-1:1 Contrast: Applies a gain to the information captured only by this band. Set to 0 to soften the image and raise up to 2 to increase sharpness. The bands are relative to the timeline resolution, with a 16:1 blur, 8:1 blur, 4:1 blur, and 2:1 blur.

Debug Band: Specifies which band is viewed when the Debug Mode isn't None.

Debug Mode: This pull-down allows you to figure out what each band targets. You can choose from None (runs the plugin normally), Low Pass Mode (shows you the information that's too low frequency to be captured in this band), High Pass Mode (shows the information that's in this band), and High Pass Gray Mode (Same as High Pass mode, but normalized to 0.5 so that the frequency data in this band is more visible).

Method: Allows you to choose between Quotient and Difference, which correspond to different ways to compute the frequency bands. In most real-world scenarios, the Quotient method provides better looking results, but the Difference method performs more accurately on zebra striped test charts.

........................

For sharpening tasks, this is probably better method, although it has limitations, of course. No method is perfect for this challenging task.
Offline

Hardy-

  • Posts: 222
  • Joined: Sun Jun 19, 2022 4:39 am
  • Real Name: Hardy Heinlin

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 12:57 pm

KrunoSmithy wrote:CAS adjusts the amount of sharpening per pixel to target an even level of sharpness across the image. Areas of the input image that are already sharp are sharpened less, while areas that lack detail are sharpened more.

Thank you very much, Kruno. I guess that's what I need. I'll take a closer look at this discussion.
I hope it will exclude the already sharp areas and the blurry areas.

Also thank you Mike and Hendrik. I think I understand the theory, but I'm not sure how to put it into practise. I was hoping for a node diagram or a step-by-step tutorial :-) (I'm no expert.)
Offline
User avatar

KrunoSmithy

  • Posts: 340
  • Joined: Fri Oct 20, 2023 11:01 pm
  • Real Name: Kruno Stifter

Re: Sharpen: Exclude contours that are sharp already?

PostMon May 13, 2024 1:04 pm

[quote="Hardy-"Thank you very much, Kruno. I guess that's what I need. I'll take a closer look at this discussion. I hope it will exclude the already sharp areas and the blurry areas.[/quote]

No problem. I am always on the lookout to solve sharpening issues, which are always a problem. So I developed few custom solutions using various similar plug ins and stuff, but its not perfect.

If you are not an "expert" of want a simple approach, Contrast Adaptive Sharpening algorithm of the AMD FidelityFX its not perfect but its easiest to use and overall delivers good results. It works in both Fusion and Color Page. I don't think there is a prefect solution for every situation but at least its better than defaults. Good luck.

Return to DaVinci Resolve

Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot] and 102 guests