Log in

View Full Version : Perspective distortion in video


rfmmars
21st March 2004, 03:58
I have a video made from 35mm slides, and the camera was set off axis giving everything a tilted look. In other words if we had a straight level line from left to right, it is running down hill to the left.

I need a filter for either VD or AVISYNTH.

richard
photorecall.net

stickboy
21st March 2004, 05:59
Try VirtualDub's internal rotate2 filter.

rfmmars
21st March 2004, 06:36
stickboy.....Thanks for the threads but I see I need to give you more info. Lets take a 720x480 rectangle, what I need to do is stretch the top left corner upward in order to make the sagging horizontal line straight inside the video frame.

I have several paint programs that do that, but I need a plugin for video.

thanks,

richard

Zarxrax
21st March 2004, 07:02
Adobe After Effects has a corner pin filter that could do this for you. I think they have a trial version on their website that you can download to use.

Soulhunter
21st March 2004, 19:36
Maybe you can use ffdshows perspective correction via its raw-filter-processing as input for AviSynth!? Dont know if this works properly, coz ffdshow gives this info... :\
This filter is in development: black dots may appear in picture and crashes with nonconvex shapes.
Bye

mf
21st March 2004, 21:46
That was my idea too, but ffdshow uses point moving so you'll get ugly pixel effects. I'd try Zarxrax's suggestion.

Soulhunter
21st March 2004, 22:18
Originally posted by mf
That was my idea too, but ffdshow uses point moving so you'll get ugly pixel effects. Thought this interpolation option -> None, Linear, Cubic would fix this!?


Bye

scharfis_brain
21st March 2004, 22:23
it doesn't matter , which kind of interpolation you're choosing.

the persepective-correction always gives black-dot-artifacts...

rfmmars
21st March 2004, 22:31
Thanks for the ideas guys & gal........since are is no movment is the video, it's a slide show, the dot problem may not be there. I will sure give it a try.

thx

richard

Soulhunter
21st March 2004, 22:48
Isn't there some way to do this with AviSynth ???

Moving each line from top to bottom one (or less) pixel more to left/right -> Fill up the resulting "blank" places with black pixels -> Crop all stuff along the longest black line up/down wards to get the right AR back...


Bye

esby
22nd March 2004, 06:26
How about upsampling the clip first,
applying correction with ffdshow decoding
and resising in avs to the correct size?
In order to limit the black-dot-artifacts...

(ffdshow limits size to 1600*1600 I think,
thus you can have some margin...)

esby

PS: that would lead to this kind of script:

# We first need to parameter ffdshow
# first, filter resize 1600*XXXX depending of AR, using bilinear
# second, perpective correction using Bicubic
src = directShowSource("../file...")
src = src.convertToyv12()
src = src.undot()
src = src.deen("a3d",3,6,9)
src = src.lanczosResize(wantedX,wantedY)
return src

LigH
10th March 2006, 20:34
Blowing some dust off this thread:

katjarella was looking for a similar solution of such a problem (http://forum.gleitz.info/showpost.php?p=257665&postcount=4) (german doom9/Gleitz board thread). For now, she sticks with the VirtualDub General Quadrilateral Transformation filter (http://avielle.chez-alice.fr/video/quadrilateral.html) because the ffdshow (ffavisynth) filter does not support parameters to set up the locations of the control points, and always setting up using the mouse is not exact enough.

Unfortunately she could not yet find a native AviSynth filter for Perspective Correction or Generic Quadrilateral Transformation so far. Would anyone be able to make one?
__

Her current "benchmarks":

- Vegas, Premiere and similar video editors: 1 - 1.5 hours per movie minute
- Quadriliteral VirtualDub filter in AviSynth: 1/4 hour per movie minute

Soulhunter
10th March 2006, 21:06
1h per minute? Shouldnt it be possible to do in realtime, via GFX or so? I mean, in newer games its common to use videos as textur... Projecting the video via texture mapping on a 3d surface should do it, no?


Bye

LigH
10th March 2006, 21:56
If you do it in OpenGL or Direct3D - yes.

If you do it in AviSynth, no...

Modelling the surfaces in a 3D renderer was not the expected solution. The result should be an AviSynth clip which can be filtered further.

Wilbert
10th March 2006, 22:33
If you do it in AviSynth, no...
I suspect Reform can do such transformations:

http://www.avisynth.org/warpenterprises/files/reform_25_dll_20050212.ZIP

foxyshadis
10th March 2006, 22:36
Sure, but if fft3dgpu can abuse the 3d card that way, it should be possible to make a filter out of it. Maybe tsp would be willing to help, if you ask.

iantri
11th March 2006, 04:34
FWIW, Virtualdub now has a filter builtin called "perspective" that does this.

not sure if its based off the filter LigH mentions.

Of course for the purposes of the original poster's situation, it would probably make more sense to scan the 35mm slides, especially since you'd have dramatically higher resolution images that you could retouch/reprint/whatever and turn it into a video slideshow if you really wanted to, but given that his[/her] post was two years ago I doubt it matters at this point :P

LigH
11th March 2006, 19:08
Thank you, Wilbert - the "Reform" filter seems to be the one katjarella was looking for!

In case of interest: I reformatted the documentation (http://forum.gleitz.info/showpost.php?p=257856&postcount=9) and exported it as PDF using OpenOffice 2.0 - so it should be readable a bit easier.