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. |
1st July 2010, 21:51 | #21 | Link |
Registered User
Join Date: Jun 2009
Location: UK
Posts: 263
|
<quote>"mask is full" means that your mask is "full white" after cropping. </quote>
Ah! I understand now. From looking at the source, I could see that it should only say "Mask full" if the mask was 100% white, but my mask isn't (I thought)... but I was overlooking the "after cropping" detail. For my first experiments, I'm using a simple white rectangle against full black as my mask, and in my keenness for speed, I see that with my loc="" string I've cropped well inside the white rectangle. <quote>Have you tried Load_Stdcall_PluginM</quote> Not yet. I'll try the newer version with that later. Thanks for your help. |
16th September 2010, 01:20 | #22 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@Reuf Toc
Love your script, tried the newer alternative (dont off hand remember name) but prefer yours. Can I though suggest that with your next script update, you include the below mod: Code:
catch (dummy) { show=true in2.analyzelogo(Masque).trim(0,-1).converttoRGB32 imagewriter(ID,0,1,"ebmp") }""") makes it much more usable and would obviate the need for me to replace it when you do make an update. Forces the script to actually save the bitmaps, dont really know how it's supposed to work without it. Also, can I suggest that you and others viewing this thread see update just posted minutes ago here: http://forum.doom9.org/showthread.php?t=154559 Have had great success using my script as a post processor to AvsInpaint, InpaintFunc combo. thanx, be good
__________________
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; 16th September 2010 at 14:13. Reason: remove "C" style ; in source |
22nd February 2011, 18:10 | #23 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@Reuf Toc
See this post for future problem in InPaintFunc.avs http://forum.doom9.org/showthread.ph...55#post1479855
__________________
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; 24th February 2011 at 05:28. |
26th April 2011, 01:05 | #24 | Link |
Registered User
Join Date: Jun 2003
Posts: 127
|
Hello. This is my first try at logo removal. I am marginally familiar with scripting but have never seen the error I am getting.
I have AVSInpaint.dll in my Avisynth 2.5 plugins folder. The script is as follows import("C:\Program Files (x86)\Winnydows\XviD4PSP5\dlls\AviSynth\functions\AudioFunctions.avs") import("C:\Program Files (x86)\Winnydows\XviD4PSP5\dlls\AviSynth\functions\VideoFunctions.avs") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\AVSInpaint.dll") Import("C:\Program Files (x86)\AviSynth 2.5\lsfmod\InpaintFunc.avs") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\FFT3dGPU.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\MT.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\MCTemporal Cleaner\mt_masktools-25.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\MCTemporal Cleaner\RemoveGrainSSE3.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\MCTemporal Cleaner\RepairSSE3.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\RSharpen.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\lsfmod\WarpSharp.dll") Import("C:\Program Files (x86)\AviSynth 2.5\lsfmod\LSFMod.avs") DirectShowSource("G:\In the heat of the night\2011_4_24_15_58_17.avi", fps=23.976, convertfps=true) ConvertToYV12() Trim(1168,159461) MT("""InpaintFunc(last, mask="G:\In the heat of the night\Logo White.bmp", loc="br", AR=16.0/9.0, mode="both", speed=10, ppmode=3, pp=75)""", threads=4, overlap=8) I get an error for line 3 that says "AVSInpaint.dll is not an Avisynth 2.5 plugin" Does this plugin only work for 2.6? Is there a 2.5 version available. My LSFMod scripts work etc. I just hadn't added the parameters for LSFMod yet. I would really appreciate any help that you can offer. Thanks BK Last edited by Beak; 26th April 2011 at 01:07. |
26th April 2011, 01:40 | #25 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
LoadCPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\AVSInpaint.dll") |
|
7th April 2012, 15:28 | #27 | Link |
Real Harper's Mockingbird
Join Date: Mar 2012
Posts: 14
|
Fizick, AMSS0815, thank you for the great work in creating inpaint tools; and Reuf Toc, StainlessS, thanx also for improving appropriate functionality. I'm not a code-writer, so having terrific difficulties to further adopt your tools according to current needs, and hope for effective help.
The problem is with semi-transparent logos, they eliminated under AVSInpaint+exInpaint+Rm_Logo, their inside fields became perfectly transparent but there are glass-like remainders after their borders. At first, I presumed that is the result of encoding artifacts (slight ringing, graining, so on), and treated the logos under variable customizations, including different logo-templates, but nothing could help. Now I guess, the glass remainders caused by aliased edges in the Pre-multiplied Alpha Channels (http://faculty.mdc.edu/jvanvori/Docs...-mystified.pdf) that probably exist in my HDTV-source. Please, help to find out the right way: 1) Is it correct when I create RGB24 logo mask, or RGB32 is needed for correct operation? 2.1) Can this problem be solved if we change colorspace or matrix when creating "Logo Color" and "Logo Alpha"? 2.2) May be the key is RGBA convertion when creating "Logo Color" and "Logo Alpha" templates? 3.1) Is it feasible at all to eliminate the Pre-multiplied Alpha Channels using your tools, and which tunings to activate in this case? 3.2) If not, are you going to add such functionality? 4) Is it helpful to debug the "Logo Color and Alpha" picture in After Effects, and how to do this? Sorry for my poor English. Thank you in advance for any help to the right way. Last edited by shark000X; 7th April 2012 at 18:34. |
8th April 2012, 13:40 | #28 | Link |
Registered User
Join Date: Aug 2006
Posts: 29
|
Hi shark000X,
I can only speak for AVSInpaint here. I don't really understand what you're doing. I guess you used AnalyzeLogo to get the logo's image and alpha mask. Is your source RGBxx or YV12? > 1) Is it correct when I create RGB24 logo mask, or RGB32 is needed for correct operation? What is your "logo mask"? In AVSInpaint there are several functions which accept "Mask" arguments, but they will reject RGB24 Mask arguments. > 2.1) Can this problem be solved if we change colorspace or matrix when creating "Logo Color" and "Logo Alpha"? If you have to convert the colorspace of the logo's alpha channel, always use Matrix="PC.601" (see DeblendLogo documentation). If you have to convert the colorspace of the logo's image, you're probably doing something wrong. > 3.1) Is it feasible at all to eliminate the Pre-multiplied Alpha Channels using your tools, and which tunings to activate in this case? I don't understand this question. The DeblendLogo function eliminates the pre-multiplied alpha channels, frame by frame. This process is slightly faster if the Logo and Alpha arguments are clips with one frame only (see DeblendLogo documentation). Besides that, I don't see how this might be done better. > 4) Is it helpful to debug the "Logo Color and Alpha" picture in After Effects, and how to do this? No. I tried this (with other software), but I never managed to improve the output of AnalyzeLogo by hand. If you feel that your alpha mask is bad, you might play around with the DeviationWeight parameter (see doc). If your clip is YV12, SubsamplingWeight might also improve your alpha mask. > their inside fields became perfectly transparent but there are glass-like remainders after their borders. Is there a glass-like border of the shape of the logo, or is there a border of a rectangular shape (where you cropped your video when doing the logo removal stuff)? In the latter case, I guess you forgot Matrix="PC.601" somewhere. In the former case, try to improve the output of AnalyzeLogo with these ideas:
-- AMSS0815 |
9th April 2012, 02:16 | #29 | Link |
Real Harper's Mockingbird
Join Date: Mar 2012
Posts: 14
|
Hi AMSS0815, thank you for fast reply!
Just to avoid some misunderstanding (my fault), here is additional information: 5) The video source: 1280x720, YV12, TV.709, 4:2:0 (it doesn't contain any non-image parts at top/bottom of screen); 6) I provide *.bmp (RGB24 colorspace - is here possible mistake?) as the "Mask" argument to the AnalyzeLogo. The BMP contains the logo image (pure white template) surrounded by pure black background. The source logo is completely contained in the "Mask", moreover tried to vary its dilating range. Legitimate movie content is not covered by the AnalyzeLogo's "Mask" argument, except the dilated area. 7) The Logo and Alpha arguments are clips with one frame only (both BMP RGB24) processed further with assistance of the Rm_Logo.avs (Spuds' subfunction). 8) As a whole result of process, the source logo is correctly replaced by legitimate underlayer but the shape of source logo turned into glass-like border. Now, after close examination I see that both subfunctions (Rm_Logo by Spuds, and InpaintFunc by Reuf Toc) operate the DeviationWeight and SubsamplingWeight parameters under default values (0.5). May be this is the graal for my situation - to tune both "Weight"s, starting with 0.25 SubsamplingWeight... Could you tell me please the reasonable measures for the DeviationWeight? Nevertheless, the above-mentioned "Last resort" remains under my consideration, though it would be in history - I've tried to set a mask over the border and cover it with Inpaint in such a (perhaps stupid) way:
9) For the above "to set mask this border by hand" - do you mean a simple painting (Photoshop or else) of white boarders in the Alpha-mask.bmp created by the AnalyzeLogo? Thank you for support, AMSS0815. My mind is clearing up under your suggestions Have a nice day! |
9th April 2012, 23:56 | #30 | Link | ||||
Registered User
Join Date: Aug 2006
Posts: 29
|
Hi shark000X,
Quote:
Quote:
This is really important! If you convert Y**<-->RGB** colorspaces with the output of AnalyzeLogo before handing the result over to DeblendLogo, you risk that the Y-levels of the mask get converted to a different scale somewhere. Quote:
Quote:
Another idea: Maybe the chroma subsampling is guilty here. I don't think so, but check what happens if you start with your clip converted to RGB24. And a sidenote: I assume you do your experimentation just with a small part of the clip. Running AnalyzeLogo is a time-consuming operation! So if you want e.g. play around with the results of different Weight parameters, you might want to use AviSynth's SelectEvery filter to reduce the number of frames analyzed (which of course reduces the quality of the output of AnalyzeLogo). It is also legitimate to crop away parts of the movie that are far away of the logo, such that the Mask you provide to the AnalyzeLogo function occupies approx 1% of the frame's area. Maybe you can post some pictures (of masks and logos and a glassy border). I'm still not sure if I understand what you're doing. Another sidenote/disclaimer: I stopped using (Windows and) AviSynth years ago, so my hints are purely theoretical. -- AMSS0815 |
||||
11th April 2012, 20:25 | #31 | Link | |||
Real Harper's Mockingbird
Join Date: Mar 2012
Posts: 14
|
Hi AMSS0815,
Quote:
I tried to play with the DeviationWeight and SubsamplingWeight, but failed to solve my problem, you were right as to their values. Unfortunately, any code-writing is still complicated for me, so further I need to go through appropriate particles of a script in different variants (please check if they are legitimate or not) to meet the above specifying questions of yours. Quote:
Code:
# We crop the analyze clip and set a percentage for speed cropped = clip.crop(L,T,R,B) snipSize = round( framecount( cropped ) / (framecount( cropped ) * (percent / 100.0) )) AnalyzeClip = ( percent != 100 ) ? cropped.SelectRangeEvery( snipSize, 1 ) : cropped # ........... # We provide the RGB24 *.bmp (C1 above) as the "Mask" argument for analysis, # the corner of interest is cropped out logo_mask = imagesource(Mask,start=0,end=1) logo_mask = logo_mask.crop(L,T,R,B) logo_mask = logo_mask.ConvertToYV12(Matrix="PC.601") logo_mask = logo_mask.DistanceFunction(255/deblendfalloff).Greyscale # ........... # We clean the analyze clip to improve results AnalyzeClip = (IsYV12(AnalyzeClip)) ? AnalyzeClip : AnalyzeClip.ConvertToYV12 AnalyzeClip = AnalyzeClip.TTempSmoothF(maxr=2,lthresh=256,cthresh=256,scthresh=255).ConvertToRGB24() # Is it better here to use ConvertToRGB32() instead of ConvertToRGB24(), or leave it without any? # # ...........here we check if a resulting ebmp exists or if it has changed # We perform the logo analysis { AnalyzeClip.AnalyzeLogo(logo_mask) # and save the resulting frame Trim( 0, -1 ) ImageWriter( "AnalyzeResult", 0, 1, "ebmp" ) } Quote:
Code:
# We split the color map and the alpha channel from the resulting ebmp AssumeFPS(AnalyzeClip.FrameRate) LogoColor = Crop(0,0,0,last.Height/2) LogoAlpha = Crop(0,last.Height/2,0,0).ConvertToYV12(Matrix="PC.601") # We use MaskTools.v2 to mark pixels that cannot be deblended LogoAlpha.Invert.mt_lut(expr="x " + " " + string(alphatorepair) + " " + "< 255 0 ?").mt_expand.mt_inflate RepairMask = ( RepairRadius > 0.1 ) ? DistanceFunction( 84.0 / RepairRadius, PixelAspect=par ) : last Code:
# Prepare repair mask (marks pixels that cannot be deblended) LogoAlpha Invert Levels(AlphaToRepair,1,AlphaToRepair+1,255,0,false) (RepairRadius>0.1)?DistanceFunction(127.0/RepairRadius):last Levels(127,1,128,0,255,false) Greyscale RepairMask = last Here is a frame of my source (see A below) -- the logo is really annoying if untouched; btw, the movie needs some color denoise, I did it but couldn't help the problem we discuss here. The logo seems to be removed (B below) with your magic tool when I provide the "Mask" argument (C below) to the AnalyzeLogo followed by simple deblending (no inpainting, no extra tunings with "weights" or else): A1> B1> C1>But under a closer look we can find unblended shapes of the logo (A below; it undergone triple upsampling for a comfortable look). Anyway, the result would be acceptable if only the shapes were not so intense against the deeply dark and light backgrounds (B below) over and over again, though disappearing within the contrasting light areas (C below): A2> B2> C2> D2>The above B and C together is a good example of the glass-like effect (the opposite shapes of the logo change their luminance antithetically when crossing over dark and light areas) that goes through all the movie. Your magic tool, as I see, is strong enough to deblend the whole logo without distructive inpaintings, but something disturbs the ability Or is it really the mosquito-noise in my source (D above)? Thank you. Waiting for your wisdom and expertise. Have a good time. Last edited by shark000X; 12th April 2012 at 09:32. |
|||
12th April 2012, 09:53 | #32 | Link |
Registered User
Join Date: Aug 2006
Posts: 29
|
Hi, I'm quite busy at the moment and will have a closer look this (UTC-)evening or at weekend. Just a few quick thoughts:
|
14th April 2012, 17:30 | #33 | Link |
Registered User
Join Date: Aug 2006
Posts: 29
|
Argh, sorry, I didn't read the script you posted.
So I suggest to cut away less (in space and time). I propose the following modified version of your script: Code:
L=clip.Width/2 # [AMSS0815 modification!] More reference area T=0 R=0 B=-clip.Height/2 # [AMSS0815 modification!] More reference area # We crop the analyze clip and set a percentage for speed cropped = clip.crop(L,T,R,B) snipSize = round( framecount( cropped ) / (framecount( cropped ) * (percent / 100.0) )) AnalyzeClip = ( percent != 100 ) ? cropped.SelectRangeEvery( snipSize, 1 ) : cropped # ........... # We provide the RGB24 *.bmp (C1 above) as the "Mask" argument for analysis, # the corner of interest is cropped out logo_mask = imagesource(Mask,start=0,end=1) logo_mask = logo_mask.crop(L,T,R,B) logo_mask = logo_mask.ConvertToYV12(Matrix="PC.601") logo_mask = logo_mask.Grayscale # [AMSS0815 modification!] Remove spurious colors from cs conversion logo_mask = logo_mask.DistanceFunction.Levels(254-8,1,255-8,0,255,false) # [AMSS0815 modification!] Inflate 8 px #logo_mask = logo_mask.DistanceFunction(255/deblendfalloff).Greyscale # [AMSS0815 modification!] Not needed (me thinks) # ........... # We clean the analyze clip to improve results #AnalyzeClip = (IsYV12(AnalyzeClip)) ? AnalyzeClip : AnalyzeClip.ConvertToYV12 # [AMSS0815 modification!] RGB is probably better AnalyzeClip = AnalyzeClip.ConvertToRGB24(Matrix="PC.601") # [AMSS0815 modification!] #AnalyzeClip = AnalyzeClip.TTempSmoothF(maxr=2,lthresh=256,cthresh=256,scthresh=255).ConvertToRGB24() # [AMSS0815 modification!] No! Not here # Is it better here to use ConvertToRGB32() instead of ConvertToRGB24(), or leave it without any? # # ...........here we check if a resulting ebmp exists or if it has changed # We perform the logo analysis { AnalyzeClip.AnalyzeLogo(logo_mask) fc = FrameCount # [AMSS0815 modification!] Save now, print later # and save the resulting frame Trim( 0, -1 ) ImageWriter( "AnalyzeResult", 0, 1, "ebmp" ) } MessageClip(string(fc)) # [AMSS0815 modification!] Print number of frames analyzed Can you upload the resulting ebmp? And of course the main question: Code:
cropped = the clip from above ! ImageSource("AnalyzeResult%06d.ebmp",0,0) AssumeFPS(cropped.FrameRate) LogoColor = Crop(0,0,0,Height/2) LogoAlpha = Crop(0,Height/2,0,0).ConvertToYV12(Matrix="PC.601") cropped ConvertToRGB24(Matrix="PC.601") last.DeblendLogo(LogoColor,LogoAlpha) The logo in your picture A1 does not seem to have any opaque areas. If this is indeed the case, there is no need to use InpaintLogo (and no need to prepare RepairMasks). Are B2 and D2 also frame from the movie --- did the camera focus on something very pink? If this does not work, you will have to draw a mask for InpaintLogo (by hand) which marks the areas that exhibit this glass effect, and then use InpaintLogo to fix those areas. Sorry, but I have no further ideas. -- AMSS0815 |
16th April 2012, 20:00 | #34 | Link | |||||
Real Harper's Mockingbird
Join Date: Mar 2012
Posts: 14
|
Hi AMSS0815,
I spent the whole weekend and monday's night for additional experiments (have more ideas) and practice upon your suggestions, so please don't consider my silence as a falling away. My last good-buy to this problem will be obvious for you as soon as possible Quote:
Quote:
Quote:
Quote:
Code:
Movie = last # 1280x720 YV12 BT709-5 DeblendFalloff=8 L=0 # Movie.Width/2 # [AMSS0815 modification!] More reference area T=0 R=0 B=0 # -Movie.Height/2 # [AMSS0815 modification!] More reference area # We provide the "Mask" argument for analysis, the corner of interest is cropped out ImageSource("D:\Temp\Logo\LogoMask.bmp",start=0,end=1).crop(L,T,R,B) Logo_mask = last Logo_mask = Logo_mask.ConvertToYV12(Matrix="PC.601") Logo_mask = logo_mask.Grayscale # [AMSS0815 modification!] Remove spurious colors from cs conversion Logo_mask = logo_mask.DistanceFunction.Levels(254-DeblendFalloff,1,255-DeblendFalloff,0,255,false) # [AMSS0815 modification!] Inflate 8 px cropped = Movie.crop(L,T,R,B) AnalyzeClip = cropped.ConvertToRGB24(Matrix="PC.601") # [AMSS0815 modification!] try{ # We check if a resulting ebmp exists or if it has changed ImageSource("D:\Temp\Logo\AnalyzeResult%06d.ebmp",0,0) (Interleave(AssumeFPS(Movie.FrameRate),AnalyzeClip.Trim(0,-2).AnalyzeLogo(Logo_mask)).FrameCount>-10)?last:last }catch(dummy){ # We perform the Logo analysis, the color and the alpha mask are returned AnalyzeClip.AnalyzeLogo(Logo_mask) # AnalyzeFrameCount = FrameCount # [AMSS0815 modification!] Analyze returns the number of frames processed as frame count of the resulting clip Trim(0,-1) ImageWriter("D:\Temp\Logo\AnalyzeResult",0,1,"ebmp") # Frame is written to hard disk } #MessageClip(string(AnalyzeFrameCount)) # [AMSS0815 modification!] Print number of frames analyzed ImageSource("D:\Temp\Logo\AnalyzeResult000000.ebmp",0,0) AssumeFPS(movie.FrameRate) LogoColor = Crop(0,0,0,Height/2) LogoAlpha = Crop(0,Height/2,0,0).ConvertToYV12(Matrix="PC.601") cropped ConvertToRGB24(Matrix="PC.601") DeblendedClip = last.DeblendLogo(LogoColor,LogoAlpha) A3> B3> C3> D3>The above D3 shows the final result when completing the code with the "step by Karel Suhajda" as you call it: Code:
Movie.ConvertToRGB32.Layer(DeblendedClip.ConvertToRGB32.Mask(Logo_mask.ConvertToRGB32(Matrix="PC.601"))) ConvertToRGB24 Quote:
At this time I'm trying variable options to convert the colormatrix of my clip before feeding it to AVSinpaint. I feel it may help. Finally, if our efforts will not be productive, do you consider a two-stage deblending as a good variant instead of post-inpainting? Thank you very much for your time. Have a good, successful day! Last edited by shark000X; 17th April 2012 at 02:02. |
|||||
21st April 2012, 03:12 | #35 | Link |
Real Harper's Mockingbird
Join Date: Mar 2012
Posts: 14
|
Hi AMSS0815,
There is not much progress with my problem. I've tried all variants of colormatrix transform (PC<->TV between 601, 709, 240 and FCC standards) that my source could possibly undergone before the final encoding. Some interesting results occurred, but they are hard to implement. The shapes of logo look better for deblending after TV.709->PC.FCC transform (yeah, my source has a European nature for sure, so it was more intuitive than logical idea to try the American FCC standard). Moreover, TV.240->PC.601 is the best variant, but still not enough for illuminated areas especially. The first conclusion here - the levels want to be restricted to TV-range before colormatrix changing. Further, let us analyze the colormatrix tables (the right one created for comfortable searching of dependences): Keeping in mind the results, I see they are better when increasing the Red coefficient up to 41% (the 0.087 differential for both 709->FCC and 240->601), while decreasing the Green and increasing the Blue coefficients. The tendency is obvious, but the Blue doesn't like a much difference from the previous state (53% loose against 31%). The second conclusion here - the color balance is not suitable for the AnalyzeLogo. Proceeding from the above conclusions I tried (assuming it is useless) to prepare the movie under AutoGain and AutoLevels (simultaneously and not) -- they certainly helped to make the logo more solid (it's a kind of goodbye to further deblending). I don't know any other way to find the good color balance for AnalyzeLogo, except the hundreds or thousands iterations for manual picking-up-and-down. Uuuff, it's driving me crazy sometime, but I continue experiments and looking for new reasonable opportunities. Since the above situation arrived, some new questions appeared: 10) Is there any additional convertion activated inside the AVSinpaint? (e.g. if YV12 or YUY2 inputed to AVSinpaint but further converted for inside RGB processing) 11) Does AVSinpaint include any specific restrictions as to color balance? If yes, how can I learn them and/or improve? I am not going to annoy like the logo does, but AMSS0815 please tell me at least if you can help me or not to deblend it. Thank you. Good bye. Last edited by shark000X; 22nd April 2012 at 23:15. Reason: the name is changed to pseudonym |
21st April 2012, 12:59 | #36 | Link | ||||
Registered User
Join Date: Aug 2006
Posts: 29
|
Hi shark000X,
I downloaded your ExperimentalClip and successfully reproduced your glass-like effect. I think you're doing everything allright, yet the problem persists. So my conclusion is that you cannot remove this logo with my tools. I observed that not only the borders of this logo, but also the interior is badly deblended: It is still brighter that its surrounding when it is in front of a bright background. Maybe the logo was added in some "nonlinear" way to the video or something else "nonlinear" happened with it while being processed further before it was delivered to you. (Nonlinear refers to some transformation that is incompatible with my linear model, see documentation of plugin). I tried to fix this with InpaintLogo, even to the point of inpainting the whole logo region, but since the logo is so big, the result was horribly ugly. (I only considered 4 minutes of your clip since I had to transform it to huffyuv, but I'm sure the results would be the same if I took the whole clip). Nevertheless I can answer your questions as follows: Quote:
Quote:
Quote:
Quote:
btw: I also tried to Analyze+Deblend a Grayscale version of your clip, and each RGB channel separately. All four tests failed, i.e., showed the glass-like effect. Sorry, I'm out of ideas. As I said above, it seems AVSInpaint isn't suitable for this kind of logo. Although my name is part of the AVSInpaint code/copyright-notes/documentation and hence public, I would prefer you use my pseudonym (AMSS0815) when you address me here. Thanks. -- AMSS0815 Last edited by AMSS0815; 23rd April 2012 at 22:31. Reason: I stand corrected |
||||
22nd April 2012, 15:41 | #37 | Link | ||||
Real Harper's Mockingbird
Join Date: Mar 2012
Posts: 14
|
Hi AMSS0815,
Quote:
Quote:
Quote:
Code:
size.total = size.width * size.height; y = yuv[position.y * size.width + position.x]; u = yuv[(position.y / 2) * (size.width / 2) + (position.x / 2) + size.total]; v = yuv[(position.y / 2) * (size.width / 2) + (position.x / 2) + size.total + (size.total / 4)]; rgb = Y'UV444toRGB888(y, u, v); ........ Errr, actually I've started this post yesterday after your reply, but the incorrect color balance of the movie was drilling my mind all the time, so I interrupted and tried the Photoshop to widely analize some frames of the source. Now it seems the movie is mainly out of gamut (Photoshop>> Select / Range / Out of Gamut). When certain colors cannot be expressed within a particular color model, those colors are said to be out of gamut. As I think, the out of gamut colors may lead the AnalizeLogo to a wrong color estimation and big mistakes when creating the color map. And, following back to Quote:
As I knew from the Photoshop Bible, to handle the out of gamut colors we need to change the hue and saturation. Heh, it is not so complicated when editing a separate image, but some kind of Hue-Saturation-Brightness model is needed to enough edit the thousands frames and preserve a good balance. Fortunately, after some non-productive experiments, I found two threads with great ideas as to this matter ( http://forum.doom9.org/showthread.ph...81#post1405481 , EDIT: http://forum.doom9.org/showthread.php?t=154731 ), and now going to try the functions... Would the end-point be successful or not, thank you AMSS0815 for your participation, efforts and the great tool. I'm going to post the results for other users here, if you don't mind, to help avoid some bothering questions in future. Anyway, if you'll have some time, the further comments are much appreciated since you are the only guru here for last years who explains the problems of logo-removing. Good bye Last edited by shark000X; 23rd April 2012 at 09:45. Reason: a wrong link corrected |
||||
23rd April 2012, 22:51 | #38 | Link | ||||
Registered User
Join Date: Aug 2006
Posts: 29
|
Quote:
Quote:
Quote:
-- AMSS0815 |
||||
25th April 2012, 19:24 | #39 | Link | |
Real Harper's Mockingbird
Join Date: Mar 2012
Posts: 14
|
Eureka!
Hi AMSS0815, I'm at complete understanding where the problem grows from. Quote:
A4> B4> C4> D4>The A4 image is correspondent to A1, B1, A2 sourced from the same frame, and B4 corresponds to B2, D2. The tendency is obvious: the logo remains closer to untouched when itself containing illegal colors (see B4<->B2), and it's better deblended when free of illegal colors (A4<->A2) but still remains visible because surrounded by out-of-gamut areas or because of the violate assumptions caused by the rest of frames (there are a lot of them like C4, D4). These images are taken after running the ShowBadRGB function, thanx to Gavino (http://forum.doom9.org/showthread.ph...32#post1403732).<EDITed It is worthy to be mentioned that the RGB space has been preliminary intended for analog devices, so nowadays it's an archaic way to produce an original material in the field of RGB which casually exists for rendering and filtering. Modern devices use the YUV space to produce video clips that often include the U and V ranged over 128 limits (so-called "out of gamut"). This means the problem is going to be typical for the majority of sources originated from the YUV space, not only mine. At this moment I see two ways to throw this problem globally away: I. If the appropriate AVSinpaint algorythm allows, to expand the analyze range to 255 for U and V to be calculated without clipping. Then the Alpha and ColorMap results have to be furhter processed and saved in the YUV colorspace (RGB processing and further conversion to YUV is not helpful of course). Here may be reasonable to process and save the U and V channels separately keeping luma the same for both. II. If the above-mentioned algorythm doesn't allow and there is no other one that could be based on 255 range, to implement the independent U and V limitation technique (http://downloads.bbc.co.uk/rd/pubs/reports/1987-22.pdf). The idea intends to avoid clipping and to keep the out-of-range U and V by means of Uout/Uin and Vout/Vin ratios. There are three variants (algorythms) but the simpliest one might be enough for logo-removing. AMSS0815, would you be so kind to modernize the AVSinpaint? You have the needed knowledge, practical experience and an alfa-beta tester in my person Looking for the productive cooperation, thanx. Have a nice day. Good bye. Last edited by shark000X; 27th April 2012 at 10:17. Reason: the ill-fitting images and further assumptions edited |
|
26th April 2012, 09:45 | #40 | Link | ||
Registered User
Join Date: Aug 2006
Posts: 29
|
OK, I just skimmed your response and I hope I understand you correctly.
Quote:
Anyway, up to programming bugs (which might always exist), AnalyzeLogo does not clip any color range. I suspect that your analysis refers to this part of the docs: Quote:
I cannot test this right now, only at weekend, but maybe you can: Apply AnalyzeLogo+Deblend to YourClip.Grayscale.Levels(0,1,255,0,127). This clip should have all pixel values in permitted ranges, and I expect you to observe the same (glass-like) problem. On the other hand, if this works well (and you have thus solved your problem at least for a Grayscale'd version of your clip), you have a point and I will have a closer look at my code. -- AMSS0815 |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|