Log in

View Full Version : Zebra patterns left on by accident - ack


Lyris
5th February 2014, 01:20
Hi forum,
I shot an interview last week which was nearly a disaster (thanks to memory card trouble!) - saved by hooking up an external HDMI recorder to my camera's output and recording that way.

One problem: the "white peaking" feature was left on. That's the feature which flashes any near-peak-white areas of the image black every few frames to draw attention to possible overexposure - and it's recorded that way since I was going from the HDMI output.

So, any whites that are near the clipping point flash black. Mercifully, these are not zebra bars like on some cameras, but fully black areas which flash on and off. And, they have totally clean edges and are not blurred. Mercifully also, most of the video is not near the clipping point, so only a small number of highlight pixels are affected.

As a result, I'm thinking it should be possible to use AviSynth to mask out pixels that are 100% black and invert them back. It doesn't matter if it wrecks the background; I can mask that out. Similarly, that peak highlight in the defocused background, for the most part, can just be painted over with white. The main challenge is getting rid of the black flashes around the glasses.

Sample file (Lagarith): http://www.mediafire.com/watch/zyl7cywc1dxapbx/zebra.avi

So far I have this, which has gone some of the way, but I'm not familiar with mt_lut or how to instruct it:


#AVIsource goes at the top

separatefields

unfiltered=last
inverted=unfiltered.invert.DeSaltPepper(opt="salt", tol=-5).DeSaltPepper(opt="salt", tol=-5)

#####################################
#Mask generation
#####################################

g_mask=mt_lut("x 3 >= 255 x 16 <= 0 x 16 - 255 * 255 / ? ?").mt_invert()

#####################################
# Do the actual luma keying
#####################################

mt_merge(unfiltered, inverted, g_mask)

#return g_mask #Debug view


weave

Has anyone run into this problem before?

ajk
5th February 2014, 09:12
As a result, I'm thinking it should be possible to use AviSynth to mask out pixels that are 100% black and invert them back. It doesn't matter if it wrecks the background; I can mask that out. Similarly, that peak highlight in the defocused background, for the most part, can just be painted over with white. The main challenge is getting rid of the black flashes around the glasses.

That is not hard to do, you can change all fully black pixels to white by

mt_lut(mt_polish("x < 1 ? 255 : x")) # mt_polish() helps if you are not used to the reverse notation

"If x smaller than 1, change to 255; otherwise leave as x"

This doesn't catch quite all of the "black" though, something like x < 3 is closer. But this will change pixels from near black to white elsewhere in the image also. You'll have to experiment.

The sample file appears to be UT video and not Lagarith, btw.

johnmeyer
5th February 2014, 09:46
I don't know what NLE you use, but I use Vegas, and it has some pretty nifty masking tools built right into the main UI. For Vegas, the "blacker than black" zebra output from your HDMI is already a mask. You can let anything show through that mask, so all you need to do is put white, or near white, and the track below the mask and it will replace the black. The advantage of doing this inside your NLE is that you can visually see the result and interactively adjust the exact level and "color" of the white you use to replace the black zebra. Even more important, you can play around with various feathering options. My concern in using AVISynth is that you may find it difficult to avoid an outline around the removed black spots, whereas with the approach I outline, you can easily adjust both the color and the feathering of the replacement video.

However, some of the masking experts here may have some suggestions that will help you achieve the same result.