Yes, indeed, but it needs a bit more elaboration. In the general case, it's not quite as simple as the example you gave:
Unstated here is the assumption that L is known, whereas in fact all you have at the start is B.
Also, you cannot assume 50% blend.
If the logo opacity is a, then B = a*L + (1-a)*O, so
O = (B - a*L)/(1-a)
The tricky part is, before we can apply this formula, we have to figure out the unknowns L and a.
This can be done (using similar algebra) if we can find some frames with a known O, eg blank frame or frame of known color. However, we need two such frames (with different colors) to completely deduce the two values. A bit of experimentation and intelligent guesswork will usually be required.
@budwzr: I don't know why you have taken against AlanHK, he has been basically correct in everything he said (I understood his comment about dynamic range in the way he meant).
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 61 to 77 of 77
Thread
-
-
Did you miss the part about it being a "simplified 50:50 mix" example? And yes, I was assuming one could find the logo on a black background somewhere in the video. And a lot of other stuff. The point was that it made perfect sense that one could "reverse the formula" in some cases.
Here's an example for budwzr. I made a video with a big logo like the OP's original. It started from a black frame so I had a reference frame at frame 0:
Here's frame 200 from the video:
Here's the same frame after this script:
src=AviSource("video.avi")
mask=Trim(src,0,1).ColorYUV(off_y=-8)
Overlay(src,mask,0,0,mode="subtract")
Overlay(last,last,0,0,ColorYUV(mask,gain_y=255),mo de="add")
Obviously, you won't always be able to find a full frame of black with the logo but with smaller logos you can usually find a frame with the logo over black, export that as an image, blacken the rest of the frame, then use that as your reference.
That exact script won't work in the general case. Only in the specific case where a bright white logo was blended with the source 50:50.Last edited by jagabo; 18th Aug 2011 at 07:14.
-
Yes, I realised you had simplified it deliberately.
I wanted to elaborate on that to make the assumptions explicit and to show that your point was still valid even without the simplification. (I wasn't trying to contradict you.) -
Last edited by budwzr; 18th Aug 2011 at 12:36.
-
intracube, that's impressive result! Thank you for your help.
AlanHK, I'll give LogoTools a try, thank you. -
i took a stab at it a couple of years ago. scene changes were my problem...couldn't quite figure out how to handle that and deal with my noisey analog source at the time. with my cleaner (satelite) sources that changes things. been leaving the logos in my current videos but i'm considering removing'em if they are easier in my disney channel videos. but i'd have to dig around for the project let alone re-aclimate myself into the code again. link below is from an old project.
https://forum.videohelp.com/threads/290371-Requesting-for-some-tv-station-logos-and-wat...=1#post1762362 -
This script:
src=DirectShowSource("rene.mp4")
mask=Trim(src,0,1).ColorYUV(gain_y=15)
Overlay(src,mask,0,0,mode="subtract")
Overlay(last,last,0,0,ColorYUV(mask,gain_y=225),mo de="add")
http://www.youtube.com/user/JAMBAberlin#p/u/21/EUSacgT1mM8
[Attachment 8265 - Click to enlarge]
Some fine tuning of the two ColorYUV() lines could probably clean it up even more. Note the first frame of the video has the logo on a black background and I used that as a reference.
I suspect LogoTools could do just as well if you use some of the advanced features. NoLogoAuto() left a bit of the logo behind. -
No doubt that a clean static logo can be satisfactorily removed using a script like that, and increasing the gain.
However, the "tiger" clip had compression blocks randomly changing the outline, so basically the edge of the logo was constantly in flux. So intracube dealt with that using a separate outline which I thought was brilliant, only there was no mention of the attributes of the outline.
But I suspect that it was feathered on the outside. That was a really sweet workaround. -
i spent the last couple of days thinking about this thread and the issues plauging us delogo'ers.
and i agree with jagabo and others regarding the issues with deloging.
looking at jagabo's 20 centry fox logo example made me realize something that didn't occur to me in my previous attempts let alone in today's. anyway. a closer look at the logo gibblets made me see the light.
say you have picA (the scene) and
picB (the logo you want overlay or make semi-transparent over picA)
to make picC
in theory or actual practice, when you create picC, you should be able to reverse it without error.
(that is, extract (demux) into original picA and picB from picC)
however, when you compress picC, i.e. jpeg or mpeg, you now have picD, because of the compression aspects that go into creating picD--its a new image. the ringing or gibblits around the edges is one of the major problems of reversing the transparency.
i would like to double-check this using code from my old project with the new set of calculations you guys supply.
so i'm asking, what is the exact calculation for creating a logo as the transparency, and the method to merge the two images into the finished product ?
what i want to do is prove to myself that this true or false. can someone please help me with this ? thanks in advance. -
As I explained in post #61, you can't directly extract A and B from C.
First you have to figure out B on its own, then use B and C to work out A.
what is the exact calculation for creating a logo as the transparency, and the method to merge the two images into the finished product ? -
There will be a little error because of rounding. In the case of a simple 50:50 weighting (A+B)/2, or more generlized with unequal weighting (A*i+B+j)/(i+j), and of course there can be even more complicated algorithms.
Yes.
You can achieve the two possibilities above with:
src=WhateverSource("file.ext")
white=ImageSource("totally white frame.bmp")
mask=ImageSource("alpha map.bmp") #determines weighting
Overlay(src,white,0,0,mask)
Some issues I noticed while playing with this: When working in YUV be careful of whether you are using PC (0-255) or REC scaling (16-235). When working in RGB I found that colors sometimes get shifted (ie, colors change, uh... color) by Overlay().
No need to prove it -- it's pretty obvious. Of course, you still may want to play around with it... -
Overlay works internally in YUV, so RGB clips get converted to YUV on the way in and back to RGB on the way out. Unfortunately, there is a rounding bug in the conversion which causes loss of color accuracy, more obvious with almost-white/grey areas or when you have repeated overlays. This bug is fixed in the latest 2.6.0 alpha version.
If working entirely in RGB, Layer is preferable to Overlay anyway - faster, simpler use of alpha layer, higher quality since no internal conversions. (And even with YV12 or YUY2 sources, Overlay converts to an internal 4:4:4 format.)
When working in YUV, I suggest that MaskTools is more suited to the current topic.
The way it works is more transparent (no pun intended ) and with functions like mt_lutxy, you can specify exactly the formula you want to combine two clips (which can be completely arbitrary).
Of course, a dedicated logo removal plugin would use its own specially written code rather than combining other filters in a script. -
Similar Threads
-
subs look transparent (sub/idx)
By X_Splinter in forum SubtitleReplies: 2Last Post: 22nd Dec 2010, 10:26 -
Transparent logos, aegisub and AviSynth
By shorto in forum EditingReplies: 17Last Post: 20th Feb 2010, 19:35 -
DVD logo with a transparent background
By cobra jet in forum Newbie / General discussionsReplies: 4Last Post: 26th Jun 2008, 15:31 -
Help remove watermark from video
By Syro_Str0m in forum RestorationReplies: 1Last Post: 14th Dec 2007, 08:46 -
Remove Watermark From DVD
By fatla00 in forum Authoring (DVD)Replies: 1Last Post: 16th Sep 2007, 15:00