PDA

View Full Version : layer(b,b,op="subtract") creates an image


nuked
25th August 2003, 20:56
as the subject says.. it's not black... it pale blues makes blues and bright whites from dusty reds, gets close to grey from sky blues. I've tried with rgb32 and with yuy2... both were converted from yv12... but I don't see how that matters.. shouldn't a subtraction of 2 identical images make nothing? Maybe I'm confused on what subtraction is. I guess I'm not sure what it means to subtract colors... but I assumed it was in an r-r, g-g, b-b, sense. I can see how this could be dificult in yuv but seems it should work in rgb. subtract(b,b) gives me a nice prefectly grey slate with no image... I guess I expected black.. but at least there's no image left.

nuked
25th August 2003, 21:03
I suppose it's silly of me to expect it's harder in yuv.. the transformations from one to the other are linear right?.. aside from some coordinate offset which can be accounted for. So I guess if subtraction works in one should work the same in the other.. anyway, just rambling.. that's not the issue anyway.

Wilbert
25th August 2003, 21:44
You have to use level=128:

b=AviSource("H:\CD1\holly_valance-naughty_girl(xvid).avi").ConvertToYUY2 #source = YV12
layer(b,b,"subtract",128)

produces perfectly grey (as it should). Maybe you can upload a few frames somewhere, if this doesn't work for you.

nuked
25th August 2003, 22:03
doh... yes, I'm retarded.. doing too many things at once. I read that threshold didn't need to be set.. but I kinda was thinking level.. works fine now. Thanks Wilbert.

nuked
25th August 2003, 22:09
now if i only manage to convert from yv12 to yuy2 and back and get dead perfect gray I'd be a happy camper.. I assume there is some small upsampling interpolation going on there, and that at the very least it will produce rounding error.. I've tried varous combinations with separate fields.. interlace=true.. etc, etc... some work better than others... none are quite perfect.

As you probably know Wilbert I'm trying to use a yuy2 filter(smoothdeinterlacer) do do my de-interlacing.. wouldn't be bad to have a zero calculation no loss conversion so that at least the parts that pass through without deinterlacing will be lossless.. anyway.. not really a big deal.. I get close enough to dead solid grey.