Log in

View Full Version : Special cases of despotting


canuckerfan
18th March 2012, 22:45
I'm trying to tackle despotting on a restoration I'm doing. So far things have worked pretty well. However there are a few cases in which I can't remove the spots completely...

Case 1:

The spot appears on more than 1 frame consecutively, so the despotter can't tell it apart from anything else on the frame. I've uploaded a clip of what I mean: http://www.sendspace.com/file/5eyl45 (check out the long white "stringy" object).

Case 2:

The spot appears on the last frame of a scene or on the first frame of a scene. In this case, the despotter can't use adjacent frames to compare with, so despotting can't detect anything. Here's a clip of what I mean: http://www.sendspace.com/file/unxa8a (you'll see some spots on the last frame of a scene)

How can I tackles these 2 cases? Is it even possible?

Edit: For what it's worth, I've been using RemoveNoiseMC in the normal cases and it has worked well.
Edit2: Sorry, you have to right-click on the links and select new tab. Otherwise if you just click the link the tab closes right away.

StainlessS
19th March 2012, 00:49
Your clip is telecine and must be reversed before any denoise/despot type functions.
removing it with: (EDIT: only downloaded 1st clip).


TFM().TDecimate()


After doing so, some hairs etc on film can last as long as about 11 frames (dont know how they managed that).
For any remaining spots lasting only 2 frames, might be able to create two separate clips using
SelectEven and SelectOdd and process these separately and then Interleave(even,odd).

As far as spots at scene change, forget it. (A predict from previous before scene change
and predict from next, after scene change might be possible).

EDIT: then telecine back to 29.97

EDIT: The long stringy thingy lasts too many frames (as noted above, some as long as 11 frames)
and despotting type filters are temporal requiring a unique spot on a single frame and straddled
by good, non spotted frames (denying scene change possiblility). Also, the stringy thingy is not
really a spot and would probably leave a few bits intact even if they existed only on a single frame.

cobo
19th March 2012, 01:01
For case 2 maybe this would work - I haven't tried it myself:
http://forum.doom9.org/showthread.php?p=1140719#post1140719

Otherwise you could replace the frame with the next or previous frame with freezeframe(), but that would be a manual operation.

StainlessS
19th March 2012, 01:15
You beat me to it (was busy with an edit).

Might be able to use these (manually),


Function PredictFromPrevious(clip Last)
{ # Predict i frame from Previous
yuy2=(isYUY2())?true:false
PreFilt=Last.DeGrainMedian() # prefiltered for better motion analysis
Last= (yuy2)?Interleaved2planar():Last
PreFilt= (yuy2)?PreFilt.Interleaved2planar():PreFilt
super=Last.MSuper(planar=yuy2)
superPreFilt=PreFilt.MSuper(planar=yuy2)
fv = superPreFilt.MAnalyse(isb = false, truemotion=true,delta = 1)
Last.MFlow(super,fv,planar=yuy2)
Last=(yuy2)?Planar2Interleaved():Last
Return Last
}


Function PredictFromNext(clip Last)
{
yuy2=(isYUY2())?true:false
PreFilt=Last.DeGrainMedian() # prefiltered for better motion analysis
Last= (yuy2)?Interleaved2planar():Last
PreFilt= (yuy2)?PreFilt.Interleaved2planar():PreFilt
super=Last.MSuper(planar=yuy2)
superPreFilt=PreFilt.MSuper(planar=yuy2)
bv = superPreFilt.MAnalyse(isb = true, truemotion=true,delta = 1)
Last.MFlow(super,bv,planar=yuy2)
Last=(yuy2)?Planar2Interleaved():Last
return Last
}


And use ClipClop() plug to select replacement frames from generated predicted clips.

canuckerfan
19th March 2012, 19:00
After doing so, some hairs etc on film can last as long as about 11 frames (dont know how they managed that).
For any remaining spots lasting only 2 frames, might be able to create two separate clips using
SelectEven and SelectOdd and process these separately and then Interleave(even,odd).
Never thought of that. I will give this a try.

For case 2 maybe this would work - I haven't tried it myself:
http://forum.doom9.org/showthread.php?p=1140719#post1140719

Otherwise you could replace the frame with the next or previous frame with freezeframe(), but that would be a manual operation.
I will have a look at that.

You beat me to it (was busy with an edit).

Might be able to use these (manually),


Function PredictFromPrevious(clip Last)
{ # Predict i frame from Previous
...
}


Function PredictFromNext(clip Last)
{
....
}


And use ClipClop() plug to select replacement frames from generated predicted clips.

Do these functions replace the bad frame with adjacent good ones?

StainlessS
19th March 2012, 23:03
PredictFromPrevious()

Creates a clip of frames where frame n was predicted from n-1.

PredictFromNext()

Creates a clip of frames where frame n was predicted from n+1.


In the link posted by Cobo, Didee uses

prev = source.selectevery(1,-1)
Creates a clip of frames where frame n comes from n-1.

next = source.selectevery(1,1)
Creates a clip of frames where frame n comes from n+1.

These are just copying frames from before or after.
EDIT: It can be more convenient to replace frame n with frame n from a different clip, than eg n-1 from the same clip.


Say you had scene change at 10/11 and 20/21

ORG=Last

prev = source.selectevery(1,-1)
next = source.selectevery(1,1)
PrePrev=PredictFromPrevious()
PreNext=PredictFromNext()

SCMD="
1,10 # Use frame 10 from Clip 1 to replace frame 10 in source, replace with prev frame
2,11 # Use frame 11 from Clip 2 to replace frame 11 in source, replace with next frame
3,20 # Use frame 20 from Clip 3 to replace frame 20 in source, replace with predicted from prev
4,21 # Use frame 21 from Clip 4 to replace frame 21 in source, replace with predicted from next
# etc
"

Result = ClipClop(ORG,Prev,Next,PrePrev,PreNext,scmd=SCMD)

In the above scene change 10/11 would use copy from before and after

In the above scene change 20/21 would use predict from before and after

If you wanted to view just the altered frames after the above add


return Prune(Result,Result,scmd=SCMD)


This of course is manual and a bit tedious, perhaps the Cobo link would be easier using SCSelect.

EDIT: The predicted frames are created from prev/next frames using mvtools, tries to eg morph the
prev/next frames to match the spotted frame but does in no way guarantee a good frame, it could be
worse than the spotted one, especially if a lot of movement between the 'morpher' and 'morphee' frames.
You may need to use eg StackVertical() on the Prev and PrePrev clips to see which provides the best
replacement and again for Next and PreNext.

EDIT: Some of the Predict from stuff can be ripped out as it only provides YUY2 capability.