View Full Version : Is there a filter to center the active part of a frame ?
neutrogenik
13th April 2006, 20:33
I recorded a vid from DVB-T (france standard is Sécam, near PAL) and the active image is not always at the same place so i can't crop it without cutting some active parts !
Here are 2 frames that illustrate the problem :
http://img15.imgspot.com/u/06/102/15/snapshot200604132101041144955384.jpg
http://img15.imgspot.com/u/06/102/15/snapshot200604132101161144955527.jpg
The active part of these frame are :
http://img15.imgspot.com/u/06/102/15/active11144955682.jpg
http://img227.exs.cx/img227/8707/active28al.jpg
I already used search but didn't find anything to do that http://img227.exs.cx/img227/23/readfaq3yp.gif
FredThompson
14th April 2006, 05:17
Think about what you propose a little bit more and you'll find out it's a horrible idea.
You'll introduce a lot of jitter.
actionman133
14th April 2006, 06:31
Perhaps, if you averaged out the active frame area over a period of 10 or 20 frames, the jitter may be somewhat smoothed out, like a temporal mask of sorts.
But, when I think about it, the idea seems flawed, due to pure human creativity. It's not uncommon for the focus of the frame to lack motion, while elements in the foreground or background are in motion. In that scenario, even with jitter removed, it would be focusing on the wrong part of the frame.
I would say that creating such an algorithm to overcome these problems would be very difficult, and probably not very efficient, either.
Not saying it's impossible, but it would be quite an achievement if you pulled it off...
FredThompson
14th April 2006, 11:06
The idea is flawed, period.
Variably cropping would add irreparable horizontal jitter.
Alain2
14th April 2006, 12:20
This is a very definitive answer... I think actionman133 may be right; we can see the effet of fizick's depan filter, it's not perfect but it does smooth out camera movements. So an intelligent cropper returning it's cropping values for each frame combined to some alogrithm like in depan and a threshold to not "depan" on small cropping differences may work.. ?
neutrogenik
14th April 2006, 13:20
Variably cropping would add irreparable horizontal jitter.
My idea is not to make a variable cropping but to center the active frame so the black borders are equal on all the vid
http://img132.exs.cx/img132/8030/15vg2.jpg
http://img132.exs.cx/img132/4759/21ix.jpg
Would be transformed into :
http://img132.exs.cx/img132/3094/37bw1.jpg
As the active part have the same size (x,y).
Anyway regarding the answers i guess there's no filter to do that at the moment (maybe because it's stupid but i still don't understand why :D ).
Thanks for your answers.
mod
14th April 2006, 14:02
If I understand, you want a filter that finds the amount of "area" with the same AR in every frame that never gets "black" in the total amount of frames?
Sorry if I didn't understand :)
neutrogenik
14th April 2006, 15:14
Exactly mod, what i call "active part of the frame" is "the amount of "area" with the same AR in every frame that never gets black"
Also i don't think that looking at every frame is needed, there could be some "sample frames" to be analysed and then the user define which sample to apply to each temporal element (i don't know if i'm very clear lol)
I want to do this because when i crop the frames 1 and 2 i'm loosing some of the active part (blue is the cropping area and green is the active part) :
http://img132.exs.cx/img132/5293/21ix7gv.jpg
http://img132.exs.cx/img132/5566/15vg23ky.jpg
Sorry if the schematics are not perfect, i used paint to do it ^^
mod
14th April 2006, 18:03
Ok, so you're looking for some "real movie area" adaptive cropping with AR preservaton.. This would allow you to save the greater possible part of video cleaning out all the black..
hmmm...
FredThompson
14th April 2006, 18:27
Using some form of software-based stabilization to fix jitter which you've created is crazy. The image is still going to jitter. The border will change when the source camera changes but it's still introducing a change.
@neutrogenik, why do you want to do this? You're mess up the aspect ratio and there's a very good chance you'll get an invalid resolution wrt encoding. You're looking at the overscan areas of analog TV cameras. Leave it alone and you'll have far fewer headaches. The edges are "bonus", anyhow.
neutrogenik
14th April 2006, 20:55
Ok, so you're looking for some "real movie area" adaptive cropping with AR preservaton.. This would allow you to save the greater possible part of video cleaning out all the black..
hmmm...
That's it ^^
I was looking for an existing filter but like it seems there is none i guess i have to crop like before :(
I could have try to do it by myself using the sources of the filter AutoCrop which can detect the active part of a frame but as i can only code in C and i never made a filter i'd better not :D
Fred > the active area has always the same aspect ratio, and even if it's not exactly the same at one time (for exemple 2 pixels more in one frame) it's better to crop the larger frames without these 2 pixels than cropping all the frames like before isn't it ?
Also could you explain me what do you mean by "jitter" ? My english is average and so is the google translation page lol
foxyshadis
14th April 2006, 22:09
Fred, it sounds like each scene has a fairly constant offset, probably because each camera has its own. So if you pick up the proper cropping from each scene, and apply it for the entire scene, you won't cause ugly per-frame jitter. Trying to analyze the black borders on a per-frame basis would lead to constant vhs-like jitter and look terrible, of course, and if it isn't constant per-scene then it's not really possible.
So you could either cut each scene by hand and add the proper crops, or invent a filter to do that automatically.
If you're encoding back to dvd it's pretty pointless, but if you aren't it makes sense to get rid of it, if it's not too much trouble (which in this case it probably is).
Alain2
14th April 2006, 22:34
Also could you explain me what do you mean by "jitter" ? My english is average and so is the google translation page lol
image shacking ("tremblement de l'image") due to the autocrop re-adjusting on each frame...
mod
15th April 2006, 11:34
IMO I don't think that the jitter would be so high. The cropping would be performed with the same paratemers for all the sequencies of frames with the same black border. Moreover the changing of black borders often means the changing of the whole content of the filmed frame, so there would be a full refresh of the picture, with no "memory effect".
The point is to find the sequence of frame swith the shortest diagonal, autocrop it and set its x/y as the final AR.
neutrogenik
16th April 2006, 15:16
Thanks Alain.
Now i need to find a good coder that want to do it :D
Or if anyone could give me a good guide for doing C filters for avisynth i can try too :)
FredThompson
17th April 2006, 08:00
Oh, now I understand the idea. In application, the shift changes as the source camera changes. I guess you should also look at top and bottom with an optional over-ride for VCR head noise. Better take color model into account, too. Neat idea.
neutrogenik
30th May 2006, 00:40
small bump, i searched all over the web for a filter that can do that and found nothing, if someone knows something that does this job i'd greatly appreciate it.
bkman
30th May 2006, 07:06
Basically you just want to apply different crop and resize parameters to different ranges of the video. I'm not sure but doesn't avisynth have some function for selecting the frame range of a given filter?
Edit: How about something along these lines?
source=mpeg2source("blah")
cam1=source.lanczosresize(640, 480).trim(start,end)
cam2=source.lanczosresize(640,480, 8, 0, -8, 0).trim(start,end)
unalignedsplice(cam1, cam2)
And so on for all of your different crop ranges. Do you get what I mean?
neutrogenik
10th June 2006, 18:35
yeah that could do it, even if it'll be long to check what are the frame ranges where the crop must be done differently :/
my current script is :
LoadPlugin("Tdeint.dll")
LoadPlugin("AutoCrop.dll")
LoadPlugin("mpasource.dll")
LoadPlugin("fft3dfilter.dll")
video=mpeg2source("NTSP.d2v", idct=5 , cpu=4)
audio=MPASource("NTSP.mpa")
AudioDub(video,audio)
FFT3DFilter(video, sigma=10)
Tdeint(order=1)
AutoCrop(mode=0, threshold=35, samplestartframe=270, sampleendframe=275,leftadd=2, rightadd=2, bottomadd=2)
#, leftadd=8, rightadd=4, bottomadd=2
What should i modify to apply Autocrop for [0;10] seconds and then reapply it for [10;20] for exemple ???
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.