alex_x
帖子: 9
注册时间: 2018-07-14 1:19

mask bright area!

2018-07-14 1:23

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!

头像
Muonium
帖子: 41
注册时间: 2016-06-18 8:48

Re: mask bright area!

2018-07-14 2:26

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.)

alex_x
帖子: 9
注册时间: 2018-07-14 1:19

Re: mask bright area!

2018-07-14 3:05

Thank you very much it works =)

alex_x
帖子: 9
注册时间: 2018-07-14 1:19

Re: mask bright area!

2018-07-14 3:25

ok one more Q,
if I want to mask the dark area, how its should be? less than 128?

头像
Muonium
帖子: 41
注册时间: 2016-06-18 8:48

Re: mask bright area!

2018-07-14 9:36

Right

alex_x
帖子: 9
注册时间: 2018-07-14 1:19

Re: mask bright area!

2018-07-14 14:24

Thanx Muonium!

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

regards!

头像
Muonium
帖子: 41
注册时间: 2016-06-18 8:48

Re: mask bright area!

2018-07-14 17:05

Yes, the formula then should be
'x 512 > 1023 0 ?' and 'x 32768 > 65535 0 ?'
for 10 and 16 bitdepth respectively.

alex_x
帖子: 9
注册时间: 2018-07-14 1:19

Re: mask bright area!

2018-07-14 22:02

Thank you very much Muonium

Regards!

回到 “VapourSynth”