PDA

View Full Version : How to create an eye blink effect?


r6d2
29th January 2004, 16:10
Hi,

I'm shooting a short film whose action is very fast and in real time. It happens in an emergency room.

The script requires the camera to be located in the eye of one of the characters, which observes everything happening around him.

I've thought of adding an effect to the whole film which mimics the eye blinking, so spectators can really feel they are looking through the character's eyes.

I guess this might be done easily in post production with AviSynth, but I have no clue on how to. May anybody suggest a filter/tool combination for this?

Thanks in advance.

mf
29th January 2004, 16:28
MaskedMerge and Unfocus. Unfocus basically does a type of blur that you could compare to taking off your glasses.

http://mf.creations.nl/avs/unfocus.png

function UnFocus(clip input, int "strength", int "radius", int "clip") {
strength = Default(strength, 200)
radius = Default(radius, 4)
clip = Default(clip, 0)
input.UnsharpMask(strength, radius, clip)
unsharp = last
YV12Subtract(input, unsharp)
YV12Subtract(unsharp, last)
YV12Subtract(last, input)
YV12Subtract(unsharp, last)
Blur(1)
}

I haven't tried the above script, but it should work. It needs WarpSharp.dll and MaskTools141 or higher. You can overlay "eyelids" over your video with MaskedMerge and blur them with unfocus, and then apply those only on some frames with JDL_ApplyRange.

scharfis_brain
29th January 2004, 16:32
I think, that it would be quite okay to just insert black frames into the video-stream for simulating lid-closing.

function blackframe(clip clip,int framenumber)
{
a=blankclip(clip)
b=clip.trim(0,framenumber-1)+a.trim(1,0)+clip.(framenumber+1,0)
return b
}

function untested, just typed here, may produce errros...

communist
29th January 2004, 16:55
If you happen to have access to any kind of NLE setup. Just do the following:
add 6-9 frames long black video over you current video. Then set the black video to fade in and out - letting it only be totally black for 1 frame. This should give you the blink effect.
Do the same with white and you'll get what I think is called 'white blinks' used to cut within the same perspective to skip time. I'm sure you have seen it somewhere on TV where they use that to shorten an interview etc. :)

mf
29th January 2004, 18:08
####
##
## Blink - a function made specially for r6d2 ;)
## WARNING: Kills audio per default.
## Parameters:
## frame = frame on which the blink occurs
## mode = either 1, 2, 3, or 4:
## 1 just makes the frame black
## 2 ditto, and unfocuses the next frame
## 3 inserts a black eyelid over the previous frame and unfocuses the next
## 4 inserts a black eyelid before as well as after the black frame
## image = path to the eyelid image, default is blink.png in the same directory as the script
## strength = unfocus strength
## radius = unfocus radius
## clip = unfocus clipping value
##
## Requirements: MaskTools141 or higher, WarpSharp, and JDL-utils.
##

function Blink(clip input1, int frame, int "mode", string "image", int "strength", int "radius", int "clip") {
input = input1.KillAudio()
mode = Default(mode, 3)
image = Default(image, "blink.png")
strength = Default(strength, 200)
radius = Default(radius, 4)
clip = Default(clip, 0)

start = frame - 1
end = frame + 1

ImageReader(image).Trim(1, 1).ConvertToYV12().LanczosResize(input.width, input.height).AssumeFPS(input.framerate)
blinkmask = last
BlankClip(input)
black = last
black.Trim(1, 1)
black1 = last
black1.Invert()
white1 = last


two1 = black1+white1
three1 = blinkmask+black1+white1
four1 = blinkmask+black1+blinkmask
two = two1.FitY2UV()
three = three1.FitY2UV()
four = four1.FitY2UV()

input.UnsharpMask(strength, radius, clip)
unsharp = last
YV12Subtract(input, unsharp)
YV12Subtract(unsharp, last)
YV12Subtract(last, input)
YV12Subtract(unsharp, last)
Blur(1)
unfocus = last

seg1 = input.Trim2(0, start)
blackseg = black.Trim3(start, end + 1)
singleseg = input.Trim3(start - 1, end + 1).Trim(1, 1)
singleseg2 = input.Trim3(start, end + 1).Trim(2, 2)
seg2 = unfocus.Trim3(start, end + 1)
seg3 = input.Trim2(end + 1)

rone = seg1 + singleseg + black1 + singleseg2 + seg3
rtwo = seg1 + singleseg + MaskedMerge(blackseg.Trim(1, 2), seg2.Trim(1, 2), two, U=3, V=3) + seg3
rthree = seg1 + MaskedMerge(blackseg, seg2, three, U=3, V=3) + seg3
rfour = seg1 + MaskedMerge(blackseg, seg2, four, U=3, V=3) + seg3


return (mode == 1) ? rone : (mode == 2) ? rtwo : (mode == 3) ? rthree : (mode == 4) ? rfour : input

}

Hope you like it :).

Edit: I was in a hurry, so I forgot to credit stickboy, whom I stole his JDL_ApplyRangeOld from for this script.
Edit2: I really was in a hurry ;) I forgot to link to blink.png (http://mf.creations.nl/avs/blink.png) which you need to use with this script :).

r6d2
29th January 2004, 18:40
Gee, that was fast! :thanks: a lot, guys. I'll try your suggestions.

t_2
30th January 2004, 21:28
For a DV film that I did a few years ago I had some footage of a fight scene that took place in a courtroom. It really looked comical because the actors were having too good a time, but this only showed up later. The solution was long and painful but worked well I think. I had to hide the smiles and make it look like a serious fight.

We proceeded by taking some some real close up footage of the main character's eye blinking using a wide angle lense. Then did a digital zoom from my original footage of the stars face to the close up of the eye. Then I superimposed the fight scene on the eyeball, (using about 50% alpha)which took up the whole of the screen. The trick was to turn off the superimposing when the eyelid was closed. At the time I didn't even know about deinterlacing so it is a bit flawed but acceptable.

I know this is looking in from outside and it sounds like you want to look out from the inside, but if you want a look at our effect you can download the film (240M) and turn on the English subtitles if you don't understand Hungarian! The address is:

http://kephangtar.plebania.net/?op=view&zid=70

If I were you I would use a wide angle lens( so that you can get close to your subject)and buy the biggest false eyelashes you can find and somehow articulate them as if they were blinking against a white backdrop. Then deinterlace using a smart deinterlacer and digital zoom so the eyelashes take up most of the screen at least when they close. Then use colorkey mask to key out the black and layer to superimpose the lashes over your background video (i.e., what the person is looking at. Don't forget to deinterlace that too before doing using layer. This might work with just avisynth.

What I describe at the top requires something other than avisynth. I used Winimages FX7 effects program. The digital zoom required a morph program which comes bundled with FX7. It not only does morphs between 2 frames, but you can also do morphs between two videos! Just like megabucks morph software. (With this feature you can do the morph of someone turning into a monster as he walks down the street.)The programs come with very complete documentation, nevertheless the whole thing took many weeks, even months to learn and accomplish.
It can be purchased at http://www.blackbeltsystems.com/fxss.html After avisynth it is absolutely the best kept secret in the video world. It takes a while to learn how to use it, and is a little buggy at times, but if is soooo powerful and the last time I looked it was under $100. Like I say, after avisynth this is THE best deal in the video world.

r6d2
31st January 2004, 00:18
Originally posted by t_2
if you want a look at our effect you can download the film (240M)
Well, I'm trying to increase the hallgatták count now. :D 10 hours to go.

Thanks for the tip.

mf
9th February 2004, 13:19
So, were we of any use to you, r6d2? :)

r6d2
9th February 2004, 14:12
@mf, actually I've not gotten to the post production phase yet (I told you were fast) ;). But I'll post the results, don't worry.

I had lots of trouble getting an ER facility to do the shooting. They are always too busy. :)

Also one of my actresses would not do the nude scene. I had to change the script or her husband would never come to my birthday again.

mf
9th February 2004, 16:32
<Insert childish remark about being a movie director and getting to shoot nude scenes here>

;)

r6d2
9th February 2004, 16:51
<Insert here childish remark about how the blinking gets very intense during that scene.>

Paky
12th March 2005, 23:12
why this error?

http://submarcos.altervista.org/error.gif

Paky
19th March 2005, 21:15
i have downloaded a wrong version of warpsharp :rolleyes: