分页: 1 / 1

mask bright area!

发表于 : 2018-07-14 1:23
alex_x
Hi everyone , hope you guys are good.


I have question about vapourynth ,
is there a function or method to mask the bright area instead of dark area and filtering the bright area ?

Regards!

Re: mask bright area!

发表于 : 2018-07-14 2:26
Muonium
Hi.

I can't remember which script has such function, but you can do it manually.

For example, suppose we want to process a grayscale image (format=vs.GRAY8), we can use the following code to construct a simple luma mask:

代码: 全选

mask = core.std.Expr(src, 'x 128 > 255 0 ?')
which classifies the pixels of the image according to their luma values.

Subsequently, we can use such mask to filter the bright area only by:

代码: 全选

bright_flt = core.std.MaskedMerge(src, flt, mask)
where "flt" is the filtering result of some function.

(Clearly, the construction of such mask is not limited to the case above, which is worth to explore by oneself.)

Re: mask bright area!

发表于 : 2018-07-14 3:05
alex_x
Thank you very much it works =)

Re: mask bright area!

发表于 : 2018-07-14 3:25
alex_x
ok one more Q,
if I want to mask the dark area, how its should be? less than 128?

Re: mask bright area!

发表于 : 2018-07-14 9:36
Muonium
Right

Re: mask bright area!

发表于 : 2018-07-14 14:24
alex_x
Thanx Muonium!

Ok, if I use depth(src,10 or 16) instead of 8 depth, it will make any difference in result ,?

regards!

Re: mask bright area!

发表于 : 2018-07-14 17:05
Muonium
Yes, the formula then should be
'x 512 > 1023 0 ?' and 'x 32768 > 65535 0 ?'
for 10 and 16 bitdepth respectively.

Re: mask bright area!

发表于 : 2018-07-14 22:02
alex_x
Thank you very much Muonium

Regards!