Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd August 2011, 01:46   #1  |  Link
Beak
Registered User
 
Join Date: Jun 2003
Posts: 127
Help with InpaintFunc

Hello I am attempting a logo removal with the following script

DirectShowSource("C:\Users\Brendan\Videos\Leviathan\Leviathan Edit.TS.12.TS.12.TS", fps=29.970, audio=false, convertfps=true).AssumeFPS(30000,1001)

loadCplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\AVSInpaint.dll")

Import("C:\Program Files (x86)\AviSynth 2.5\plugins\InpaintFunc.avs")



InpaintFunc(last, mask="C:\Program Files (x86)\AviSynth 2.5\plugins\logo.bmp", loc="br", AR=16.0/9.0, mode="both", speed=10, ppmode=3, pp=50)

Avisynth does not report a line error but the script crashes both MeGui and Bsplayer.

All the locations are accurate and the mask is black with white where the logo is as specified.

Any thoughts would be greatly appreciated.

Thanks BK
Beak is offline   Reply With Quote
Old 3rd August 2011, 17:29   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Beak View Post
Avisynth does not report a line error but the script crashes both MeGui and Bsplayer.
InpaintFunc scans the entire file when first used & creates a data
file, I'm guessing that you are taking this as a crash, when in fact it is busy working, it can take quite some time for this 1st pass.
After the first pass, it would need to be restarted, eg in VirtualDubMod, you would re-open the AVS file (or F7 in the
script editing window).

In addition, I would suggest that you see this post here, InpaintFunc misbehaves a bit without the addition mentioned there.
http://forum.doom9.org/showthread.ph...09#post1443309

Changing:
Code:
              catch (dummy)
               
              {in2.analyzelogo(Masque).trim(0,-1).converttoRGB32
              imagewriter(ID,0,1,"ebmp")      }""")
To:

Code:
   catch (dummy) 
              {
              	show=true
              	in2.analyzelogo(Masque).trim(0,-1).converttoRGB32
              	imagewriter(ID,0,1,"ebmp")      
              }""")
If the above suggestion is unrelated, would be good to upload at least a few dozen frames with a at least one change in scene.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 4th August 2011, 01:35   #3  |  Link
Beak
Registered User
 
Join Date: Jun 2003
Posts: 127
Hello and thank you for your help. I added the code you suggested. If I understand correctly the stats or log file would be saved somewhere but I cannot find this file, at lest not in the directory where the clip is.

I was partially successful after shortening the clip and allowing sufficient time for it to scan.

Here is the unretouched original





Here is the partially repaired file



The area within the black border has turned magenta but the overlapped area seems partially repaired. can you tell me how to repair this? I suppose I could crop, use the function then re add the borders but if there is an easier way that would be great.

Is it possible to scan a small portion of the clip then apply the function to the entire clip? Will I need the log or stats file I can't find?

The mask I created has pure white on top of the logo but may not be pure black around the logo. Is this critical?

Thanks again for your help because this is the closest I have got to having this work.

Last edited by Beak; 4th August 2011 at 02:15. Reason: images not working
Beak is offline   Reply With Quote
Old 4th August 2011, 02:48   #4  |  Link
Beak
Registered User
 
Join Date: Jun 2003
Posts: 127
OK. The data file regarding the mask is kept in the folder where the mask is not the clip. Still having the magenta issue. Any suggestions would be greatly appreciated.
Beak is offline   Reply With Quote
Old 4th August 2011, 04:13   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hi,

Did try to tell you about the path the data file is saved to, being the mask path,
"Server Too Busy, Please Try Again Later".

With the clip you have, the black border will present a problem whether you
mark the border area of logo as either logo, or not logo. Cropping off the
border and replacing later should work ok, however I personally would crop
out an area around the logo (excluding any contained in border) and work on
that, this will give you a much smaller bitmap to scan and hence a lot faster,
also note, despite what you might think, the source clip is globally modified,
not just the area where the logo mask is (if the alpha map is non black anywhere
outside of the logo area). I would work on the local area around the logo, so that
only this is modified, and then Overlay the resultant de-logoed image
back from whence it came. To use this method, I would scan the entire cropped region using
eg

Code:
loc = "0,0,-0,-0"
The Mask would of course need to be the same size as the cropped area. I would probably
save the resultant de-logoed clip as eg HUFFYUV and the Overlay this back upon the full
size source clip.

Having said that, I might actually not bother with InPaintFunc at all in your situation,
the "S_ExLogo.AVS" script should I think perform pretty well and although InPaintFunc might
be marginally better, S_ExLogo() would be an awful lot quicker, give it a whirl, it should
be quite easy to set up and will run in a least real time. S_Exlogo was written to cope with
a border area such as yours, simply set up the logo area for the entire logo (LOGOMODE=0) and
then switch to LOGOMODE=1 to set up the border clipping (VirtualDubMod may be best for this),
then finally switch to LOGOMODE=2 for actual usage.
S_ExLogo requires YUY2, xcoords and width need to be Mod 2.

Good Luck

http://forum.doom9.org/showthread.ph...light=s_exlogo

EDIT: from AVSInpaint docs-
All pixels of the source clip where this mask has values greater than 127 will be inpainted.

In your case you would set ClipH to clip the border (S_exlogo) , -ve values are probably easiest, ie the
negative height of the bottom border.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th August 2011 at 04:26.
StainlessS is offline   Reply With Quote
Old 5th August 2011, 13:55   #6  |  Link
FlimsyFeet
Guest
 
Posts: n/a
Wouldn't it be easier to crop out the balck bars first, then inpaint just the little bit of logo left in? I can't really tell form the image, but it may be an alpha-blended logo, in which case LogoTools would be better than inpainting.
  Reply With Quote
Old 5th August 2011, 17:22   #7  |  Link
Beak
Registered User
 
Join Date: Jun 2003
Posts: 127
That's what I was going to try. Crop then use inpaint then add borders again.But then I have to resize as well.

I will try the other function suggested or crop the mask to avoid the border.

What would really be great is if this function would just recognize the border and work without the pink.

I'd rather not use old filters unless it will just scan and detect the logo automatically and adjust its own parameters to remove more or less automatically.
Beak is offline   Reply With Quote
Old 6th August 2011, 00:00   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Sorry, yes cropping black bars with later add-back, would of course be required, forgot to mention that.
With s_exlogo, it would not matter if black bars were cropped before of after logo removal, it would
not touch the borders and leave the border logo as is. The main advantage to s_exlogo's clipping, is
that standard logo coords can be used (same for all captures from a particular station), you only need
set the clip coord for the current border, and then later crop out the borders.
Try the s_exlogo thing, takes less than 2 mins to set up and real quick. If you really want to spend
time though, do the Inpainting or the suggested LogoTools.

Edit: If border is cropped prior to s_exlogo, then no clip coord needs be set.
Also, the cropping is used primarily to avoid replacing a nasty logo with an equally
nasty black blob, created by using parts of the border area to infill the logo.
You could chain remove a half dozen logo's using s_exlogo, and it would still probably
run in better than real time, the same probably cannot be said for the other mentioned methods.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th August 2011 at 02:00.
StainlessS is offline   Reply With Quote
Old 6th August 2011, 15:31   #9  |  Link
Beak
Registered User
 
Join Date: Jun 2003
Posts: 127
Thank you for your help. I now have a working script using the inpaint function. My two pass encodes generally run at 8.5fps. With the crop, resize, inpaint, Toms MoComp, and add borders, I am down to 5.2fps so I am looking at 18 hours.


I will try S_ExLogo.AVS on my next project.

Thanks again +++
Beak is offline   Reply With Quote
Old 8th August 2011, 01:46   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hi Beak, you have prompted me to have a go at processing the border area seperately,
ie remove the border area logo by taking whatever surrounds the border and filling
that border logo area with that content. Pretty similarly to how the active area logo is processed,
however, it would probably involve a lot more additional script code, perhaps even more than current
version (just for the border logo, as one would have to deal with eg 4 possible locations, left
of active area, right, above or below). I dont know if I actually ever considered doing this before,
if I did, then it was the considerable script size increase that probably deterred me from doing it.
It would however, make things a little more automatic and not require cropping and re-adding
the borders again. I'm quite sure this is going to come into fruition, and not take too long,
and should have neglidgable impact on speed (I hope), except where there is letterboxing where
it should still be non too sedate. Thankyou for poking me in the right direction.

Edit, will notify in the s_exlogo thread, when done.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 8th August 2011 at 01:56.
StainlessS is offline   Reply With Quote
Old 8th August 2011, 13:50   #11  |  Link
Beak
Registered User
 
Join Date: Jun 2003
Posts: 127
Well, FWIW it doesn't take much time to set up the crop and add borders. What takes the time is creating the mask.

I tried MSU logo remover and it was supposed to just analyse the video and remove the mask after being told roughly where to look for the logo.

Didn't work for me though at all.

This does work very very well. Thanks again.
Beak is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.