View Single Post
Old 14th April 2012, 17:30   #33  |  Link
AMSS0815
Registered User
 
Join Date: Aug 2006
Posts: 29
Quote:
Originally Posted by AMSS0815 View Post
You wrote you saved a small clip to a separate file.[...]
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
Does the number printed here match the framecount of your input clip (with percent=100)?
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?

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