View Single Post
Old 16th April 2012, 20:00   #34  |  Link
shark000X
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:
Originally Posted by AMSS0815 View Post
You wrote you saved a small clip to a separate file. Try to avoid such steps, especially if they involve loosy compression. Always work with the original clip...
.............
Reducing the framecount (Trim/SelectEvery) will reduce the AnalyzeLogo quality.
.............
Does the number printed here match the framecount of your input clip (with percent=100)?
From the very beginning I've been processing the experimental clip (a 4-minutes cut out from the source) that keeps the original quality - no trimming, no compression. When experimenting, it's a rule for me to use the Lagarith lossless if encoding needed... The above-suggested FrameCount() shows the same number of frames as the input movie includes.

Quote:
Originally Posted by AMSS0815 View Post
Make sure you're delogo'ing does not inadvertedly use the old AnalyzeLogo output.
No problem here.

Quote:
Originally Posted by AMSS0815 View Post
Are B2 and D2 also frame from the movie --- did the camera focus on something very pink?
Here is the experimental clip: https://rapidshare.com/files/3942090...imentalClip.ts . The B2 and D2 are frames from the movie (see closer to the end of the clip).
Quote:
Originally Posted by AMSS0815 View Post
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)
What does this look like?
Here is the ebmp (https://rapidshare.com/files/3729381...ult000000.ebmp) resulted from this script:
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)
Here is Alpha (A below) from the above ebmp, and the result of deblending (B below, comparing to B1) that partially includes the Alpha -- this effect is more visible instead of light background (C below) /is it a wrong estimated alpha mask?/.
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:
Originally Posted by AMSS0815 View Post
I cannot see dynamics though. Do you have the feeling that it changes from frame to frame, maybe in front of a bright background?
When deblending with previous settings (a highly-cropped clip analized), I have the feeling that aftershapes change their colors depending on a mix of surrounding colors, and a mix of dark colors is partially masked by a darker background, while be more visible instead of bright backgrounds. But uncropped frames as well as twice-cropped ones look as if AVSinpaint is focus-sensitive, I mean it may be not correct in analizing big areas and may cause mirror-effects on small areas (I do wish I'd be mistaken in this matter) when going far away from an artificial center (e.g. when a set of calculations start from and depend on a set of core measures, such as 720 width and 576 height, with further enlargement or shrinking from this core).

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.
shark000X is offline   Reply With Quote