VideoHelp Forum
+ Reply to Thread
Page 3 of 3
FirstFirst 1 2 3
Results 61 to 77 of 77
Thread
  1. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by jagabo View Post
    No, it's not. It's simple algebra. The basic math is in post 13 in this thread.
    Yes, indeed, but it needs a bit more elaboration. In the general case, it's not quite as simple as the example you gave:
    Originally Posted by jagabo View Post
    Simplified (a 50:50 mix):

    B = blended image:
    O = original image
    L = logo image

    B = (O + L) / 2

    Reversed:
    O = B * 2 - L
    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).
    Quote Quote  
  2. 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:

    Click image for larger version

Name:	f0.jpg
Views:	481
Size:	20.6 KB
ID:	8249

    Here's frame 200 from the video:

    Click image for larger version

Name:	f200.jpg
Views:	415
Size:	38.2 KB
ID:	8250

    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")
    Click image for larger version

Name:	reversed.jpg
Views:	488
Size:	33.8 KB
ID:	8251

    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.
    Quote Quote  
  3. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    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.)
    Quote Quote  
  4. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    OK, I found a method that eliminates the handwork. Still fine tuning, here's a rough taster:

    Click image for larger version

Name:	mask1.jpg
Views:	213
Size:	195.9 KB
ID:	8260

    The idea is to bump it, then hit it with light from 4 angles and composite. This one is only lit on two sides. Note that the edge roughness is captured.
    Last edited by budwzr; 18th Aug 2011 at 12:36.
    Quote Quote  
  5. Originally Posted by Gavino View Post
    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.)
    Good job.
    Quote Quote  
  6. snow leopard Athari's Avatar
    Join Date
    Aug 2011
    Location
    Kazan, Russia
    Search PM
    intracube, that's impressive result! Thank you for your help.

    AlanHK, I'll give LogoTools a try, thank you.
    Quote Quote  
  7. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    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
    Quote Quote  
  8. 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")
    worked pretty well with one of the OP's other videos (I used the 720p version):

    http://www.youtube.com/user/JAMBAberlin#p/u/21/EUSacgT1mM8

    Image
    [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.
    Quote Quote  
  9. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    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.
    Quote Quote  
  10. Obviously, more complex situations require more complex solutions.
    Quote Quote  
  11. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    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.
    Quote Quote  
  12. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by vhelp View Post
    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)
    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 ?
    See post #61.
    Quote Quote  
  13. Originally Posted by vhelp View Post
    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)
    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.

    Originally Posted by vhelp View Post
    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.
    Yes.

    Originally Posted by vhelp View Post
    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 ?
    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)
    That produces a simple white logo blended into the video. Of course, the logo doesn't have to be all white. It can be grayscale or even color, making it much more difficult.

    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().

    Originally Posted by vhelp View Post
    what i want to do is prove to myself that this true or false. can someone please help me with this ? thanks in advance.
    No need to prove it -- it's pretty obvious. Of course, you still may want to play around with it...
    Quote Quote  
  14. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by jagabo View Post
    When working in RGB I found that colors sometimes get shifted (ie, colors change, uh... color) by Overlay().
    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.
    Quote Quote  
  15. Thanks Gavino. That explains the problems I was seeing.
    Quote Quote  
  16. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    Click image for larger version

Name:	snap121.jpg
Views:	1896
Size:	11.3 KB
ID:	8285

    Yeah, I get it, you cookie cut the logo, apply gain, then paste it back in.
    Quote Quote  
  17. Originally Posted by budwzr View Post
    Image
    [Attachment 8285 - Click to enlarge]


    Yeah, I get it, you cookie cut the logo, apply gain, then paste it back in.
    No, subtract it out.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!