I have a html <video>
tag on a page. How is it possible to apply sharpness filter using css filters? I know how to use css filters, but no sharpness filter is available is css filters. I also have checked this question: How to sharpen an image in CSS? but the sample is written for div
s and so complicated to apply to <video>
tag.
Any suggestions and code samples appreciated.
There is no built-in sharpness filter in CSS. But you can create an unsharp mask using a SVG filter and reference it in CSS. However, these can be quite slow and I'm not sure they're going to be fast enough to run on a video.
The sharpness radius is controlled by the size of the blur (the stdDeviation) and the mix (k2 & k3) between the original and the blur. In an unsharp mask, the blur is sutracted from a (boosted) original - so the k2 (original multiplier) and k3 (blur multiplier) should add up to 1.
Here's an interactive toolet - which also allows you to make the contribution from the blur positive - which creates a soft-focus effect. https://codepen.io/mullany/pen/oJAjv
You can also do a more basic sharpening filter using a convolution matrix.