Television Logo Killer - Page 1
Forum section: electronics / projects

author: johnwa
author_rank: Frequent Contributor
timestamp: April 28, 2014, 11:19:19 am
content: Hi All,I thought some people might be interested to see my current project, which is now approaching a reasonable degree of completion. It is an inline module for removing television station watermarks from live video in real time.A number of TV channels here in Australia transmit their logos as a semitransparent graphic overlayed on the picture. It occurred to me that, provided that the logo has at least some degree of transparency, all of the information required to recreate the original picture is being transmitted. For any given pixel under the logo, the original pixel is simply being subjected to brightness and contrast changes - a simple linear function. Applying the inverse function will result in the transformation being ‘undone’. Of course, different pixel positions will require different inverse functions. These can be derived from a reference image of the logo being cancelled, and an alpha mask.The module I have come up with has inputs and outputs in analogue RGB formats. The input signal is first digitised into three 8-bit values. A 16-bit SRAM framebuffer containing the reference logo and mask images is synchronised to the incoming video signal. All this data is fed to an FPGA, which implements the linear function described above. It also contains a simple digital filter, to blur any residual image of the logo that was not nulled out completely. Finally, the processed video data is converted back into an analogue signal.The FPGA used is the Lattice iCE40HX1K device. Video ADC and DACs are an AD9983A and ADV7125KSTZ140, both from Analog Devices. There is an ATMega644A running the show, with an attached Micro SD card for loading the mask images. The address counters were done in discrete logic due to a lack of pins on the FPGA. The design maximum dot clock is 65MHz, though I am only running it at about 30 at the moment.I will hopefully be able to put together a full description of the system at a later date, but I have attached a few pictures here to give an idea of the overall system. The video pass-through quality is quite good, albeit not perfect. The logo nulling is also fairly impressive, though it could be improved by allowing the strength of the cancelling function to be adjusted, and also possibly by using individual RGB or YUV mask images, rather than a single greyscale one.Other than this, the only other issues are related to usability, as the template corresponding to the particular channel one is watching must currently be selected manually, and loading a new template takes around 15s. Faster loading could be provided, but is currently hampered by lack of resources in the FPGA. I had also hoped to provide automatic recognition of which logo is being transmitted, and automatic selection of the corresponding template, but the algorithm for this requires further development, and implementing it would also require a new hardware revision.I hope this is of some interest to readers. Let me know if you would like to see more about this project.

author: Wilksey
author_rank: Super Contributor
timestamp: April 28, 2014, 11:41:20 am
content: I would be interested to see more on this product.+1 from me!

author: LukeW
author_rank: Frequent Contributor
timestamp: April 28, 2014, 11:51:41 am
content: Very clever.And because the logo typically goes away during ads, if you detect when the logo goes away you might be able to do clever things like automatic channel hopping and then back to the original channel precisely when the ads stop, or automatic pausing of theVCRcomputer or PVR to remove ad breaks when recording video from the TV.

author: johnwa
author_rank: Frequent Contributor
timestamp: April 28, 2014, 12:18:26 pm
content: Quote from: LukeW on April 28, 2014, 11:51:41 amNow there is a thought!I remember wondering years ago how one could automatically discern program content from advertising. Now, as a side effect of the networks' shameless self-promotion, they are effectively transmitting a signal that says 'this is the actual program content, it is safe to watch now'! I would imagine that the logos switch with a fairly deterministic delay from the start/end of the program, so with the aid of a few seconds of video delay, it should be possible to switch at the exact start and endpoints.Regarding the logo recognition function, I did experiment with this a bit (using a PC-based implementation), and I got it half-working, but it was not reliable enough for casual viewing. However, there are plenty of established techniques in image processing, that I did not really look into then, and I don't think it would be too hard to improve the recognition function enough to make a logo-based ad zapper feasible.You may have provided the inspiration for my next project LukeW, thanks!

author: ecat
author_rank: Frequent Contributor
timestamp: April 28, 2014, 12:35:15 pm
content: Quote from: LukeW on April 28, 2014, 11:51:41 amiirc logo detection is one of the tricka some video transcoding sw performs when removing advertisements from recorded programs. I'd need to hunt out the video app I'm thinking of but if anyone is interested just let me know.Edit:This is the app I was thinking ofhttp://www.videoredo.com/en/Compare.htm"Automatic AdDetective commercial detection".

author: Rory
author_rank: Frequent Contributor
timestamp: April 28, 2014, 05:30:04 pm
content: This would also be a good commercial audio muting application for live programming...

author: rainking
author_rank: Newbie
timestamp: April 28, 2014, 06:04:05 pm
content: hi johnwa, have you tried YPbPr input too?I'm using the AD9983A on a project (tv or dvd inputs to a tablet sized TFT output); works perfect with PC input but I can't get the colors right with 480i/p, and it's just all messed up at 720p/1080i...

author: mariush
author_rank: Super Contributor
timestamp: April 28, 2014, 06:30:20 pm
content: I guess if you want to learn something, it's an interesting project.There are however quite a lot of "logo removal" filters/plugins for software applications like Virtualdub or other video capture programs that can remove opaque, transparent, static or moving (rotating) logos ... some of them in realtime.The opaque logo removal is usually done by analyzing a series of frames and using the motion vectors to predict what should be behind the logo...

author: fcb
author_rank: Super Contributor
timestamp: April 28, 2014, 08:24:54 pm
content: Neat project - well done.

author: denelec
author_rank: Regular Contributor
timestamp: April 28, 2014, 09:05:40 pm
content: It would be great for plasma TV owners.Some logos can cause burn-in.

author: johnwa
author_rank: Frequent Contributor
timestamp: April 29, 2014, 07:23:43 am
content: Quote from: Wilksey on April 28, 2014, 11:41:20 amOK, I have got a bit of a writeup on the go, but it might be a little while before it is ready.Quote from: rainking on April 28, 2014, 06:04:05 pmNo, rainking, I'm afraid I haven't tried YPbPr input. However, I did have terrible trouble getting the DC restoration on the chip to work properly. I was getting very dark, partially clipped images through the system. In the end, I think I had to use a mid-span biasing mode, which is actually intended for use with colour difference signals. I am not quite sure why this was required, or why it works, though the picture is quite acceptable.I don't know if this is related to your problem at all. In what way exactly is it "all messed up"?Quote from: mariush on April 28, 2014, 06:30:20 pmWell, looks like I might be a bit behind the times... I was aware of MPlayer's filter, though this just does spatial interpolation over the logo region. It makes me wonder though, why haven't TV manufacturers implemented some of these algorithms already? I am sure current smart TVs would have enough processing power, and it would make a good selling point. Perhaps they don't think they can get away with it!

author: zapta
author_rank: Super Contributor
timestamp: April 29, 2014, 11:03:00 pm
content: Reminds me the story of the color erases and the color anti eraserhttp://en.wikipedia.org/wiki/Color_killer#Color_eraser_.28mekhikon.29I also saw in Japan once a TV that adjust down the volume during commercial, I think it was simply detect the higher sound volume and bump it down.Anyway, very impressive project.

author: Unknown
author_rank: Unknown
timestamp: April 30, 2014, 01:32:05 am
content: I already solved this problem...I stopped watching televisionAnyway, sounds like a nice bit of engineering.

author: miguelvp
author_rank: Super Contributor
timestamp: April 30, 2014, 05:45:31 am
content: Quote from: steverino on April 30, 2014, 01:32:05 amI validate your result, I also stopped watching television. My wife still wants me to watch shows with her for "quality" time I haven't give in yet. Quality and TV just doesn't go together.

author: peter.mitchell
author_rank: Super Contributor
timestamp: April 30, 2014, 08:07:01 am
content: a way of detecting when adverts start is by detecting when subtitles stop

author: Grayfox
author_rank: Regular Contributor
timestamp: April 30, 2014, 08:52:39 am
content: Quote from: peter.mitchell on April 30, 2014, 08:07:01 amSome ads have subtitles though.Saw it when teletext was working.IIRC it was a ad about hearing impairment, but these days it may be in every ad since video, audio and text advertising will make money.But damn that is sweet, I take it you can add a program to change the location of the watermark removal added by the network.And is it me or can you still see some part of the watermark if you pay real close attention.

author: johnwa
author_rank: Frequent Contributor
timestamp: April 30, 2014, 10:44:13 am
content: Quote from: zapta on April 29, 2014, 11:03:00 pmInteresting, I hadn't heard of this. I think something similar happened here in Australia, before the "official" start of colour broadcasting.Quote from: Grayfox on April 30, 2014, 08:52:39 amYes, you just need to capture a sample of the transmitted logo against a black and a white background. The mask image can then be computed from these pictures.Quote from: Grayfox on April 30, 2014, 08:52:39 amYes, it is still visible if you look closely (see attachment - sorry about the out-of-focus). I would like to add some sort of gain control that could be adjusted in real time, for minimum visibility, but I have run out of room in the FPGA. There is also a slight colour shift occurring - this could be due to nonlinearities in the transmitted colour encoding, or I might be missing some colour weighting coefficients somewhere.Anyway, thanks for the feedback everyone

author: rainking
author_rank: Newbie
timestamp: May 14, 2014, 03:12:59 am
content: hey johnwa, if you're interested, i played with that chip a little more...I use mid-scale clamping on Red and Blue when using a DVD player or cable box input, and clamp to ground on all channels when using a PC for input. This usually gives me the best color reproduction, but i still haven't gotten it perfect.I went for a minimalist initialization and found the AD9983 defaults are almost good enough for most cases:Code:write_i2c_device(0x01,0x73);//PLL Div MSBwrite_i2c_device(0x02,0x80);//PLL Div LSBwrite_i2c_device(0x03,0xc8);//VCO/CPMPwrite_i2c_device(0x05,0x02);//red gain offsetwrite_i2c_device(0x06,0x00);write_i2c_device(0x07,0x02);//green gain offsetwrite_i2c_device(0x08,0x00);write_i2c_device(0x09,0x02);//blue gain offsetwrite_i2c_device(0x0A,0x00);write_i2c_device(0x20,0xc7);//Output Select 2write_i2c_device(0x3c,0x0d);//Initialize the AD9983A for YPbPr inputwrite_i2c_device(0x1B,0x7b);//Clamp and Offsetwrite_i2c_device(0x0B,0x40);//red channel offsetwrite_i2c_device(0x0C,0x00);write_i2c_device(0x0D,0x02);//green channel offsetwrite_i2c_device(0x0E,0x00);write_i2c_device(0x0F,0x40);//blue channel offsetwrite_i2c_device(0x10,0x00);write_i2c_device(0x18,0x2a);//Coast and Clamp control: 20 for RGB, 2A for YPbPrUsing this code i've gotten:1080i = ok480p = ok720p = bottom cut off480i = split screensAny idea if there's any settings on the AD9983 to adjust properly for 720p or 480i or is this completely dependent on the output display?

author: johnwa
author_rank: Frequent Contributor
timestamp: April 24, 2016, 12:25:31 am
content: If anyone is still interested, I have finally got round to uploading a full description of this project athttp://loopgain.net/logokiller/.

author: Kilrah
author_rank: Unknown
timestamp: April 24, 2016, 03:46:33 am
content: Very interesting to see a hardware solution for that!

author: GK
author_rank: Super Contributor
timestamp: April 24, 2016, 07:31:27 am
content: Could you do one of these that can make Amanda Jason's clothes disappear?

author: SeanB
author_rank: Super Contributor
timestamp: April 24, 2016, 08:25:53 am
content: You need to watch Ukranian TV for that, there are some which use news and weather women who do not need a budget for clothing at all, just for Victoria’s secret instead.

author: Fungus
author_rank: Super Contributor
timestamp: April 24, 2016, 08:36:43 am
content: Quote from: denelec on April 28, 2014, 09:05:40 pmMost stations make the logo drift slowly around on screen to avoid this.Try it: Mark the position of the logo with a post-it and watch TV for a while.(now we find out which stations/countries don't give a damn about your plasma TV...)

author: German_EE
author_rank: Super Contributor
timestamp: April 24, 2016, 10:54:49 am
content: Here is an example of Hungarian TV Weather PresentationOther examples of her are available. The link above is safe for work but others may not be.

author: johnwa
author_rank: Frequent Contributor
timestamp: April 25, 2016, 12:47:38 am
content: Quote from: Fungus on April 24, 2016, 08:36:43 amI didn't notice this at all when I was developing the unit - the position was stable over a period of at least several weeks. And on ABC (the government broadcaster) too! Perhaps they reckon it will be good for the economy if everyone has to buy a new TV...

author: dave_k
author_rank: Frequent Contributor
timestamp: April 25, 2016, 06:46:13 am
content: Great project!The problem you will have is that the watermarks broadcasters use nowadays are rarely static. Some are animated to begin with, others are customised (ie - coming up next) and some change position on screen from lower-right to upper-right depending on programming. Then there is the added fun of lower-third graphics which are sprinkled through programs from time to time.

author: Fungus
author_rank: Super Contributor
timestamp: April 25, 2016, 01:53:50 pm
content: Quote from: johnwa on April 25, 2016, 12:47:38 amOr maybe they assume you only ever watchtheirchannel so it doesn't matter.PS: The ones I've seen do this drift the logo over a matter of minutes. It's not hard to see it moving if you're paying attention.

author: rdl
author_rank: Super Contributor
timestamp: April 25, 2016, 05:16:53 pm
content: What is the point to having those damn logos on screen constantly? I find them distracting and highly annoying. National Geographic is one of the worst. Do TV broadcasters think it's good to intentionally piss off their viewers? When they first became technically possible the US had strict rules about when and how long they could appear (not very often and not very long) but I guess that was deregulated long ago.

author: miguelvp
author_rank: Super Contributor
timestamp: April 25, 2016, 05:30:21 pm
content: Quote from: rdl on April 25, 2016, 05:16:53 pmCopyright?

author: Fungus
author_rank: Super Contributor
timestamp: April 25, 2016, 05:47:10 pm
content: Quote from: miguelvp on April 25, 2016, 05:30:21 pmHow can it possibly prevent copying or enforce copyright?I'll use Occam's razor: It's just megalomania by pointy-haired-bosses.(sound of keyboard)Yep, Wikipedia agrees:https://en.wikipedia.org/wiki/Digital_on-screen_graphicIt's all about "brand recognition".

author: Kilrah
author_rank: Unknown
timestamp: April 25, 2016, 06:07:26 pm
content: And copyright.Quote

author: KE5FX
author_rank: Super Contributor
timestamp: September 02, 2016, 07:29:48 pm
content: Cool project, I've thought about this problem before in a couple of different contexts. Did you give any thought to using autocorrelation to infer the location of the logo? The correlator would run continuously at timescales of a minute or so, and any portions of the frame that exceed a given autocorrelation coefficient would be subtracted from all outgoing frames.

author: johnwa
author_rank: Frequent Contributor
timestamp: September 05, 2016, 09:23:00 am
content: Thanks KE5FX, I had thought about this a bit in general terms, but had not worked out the specifics. Do you mean actually deriving the logo in real-time from the video stream, or simply finding the spatial position of a predetermined logo? The former might be feasible, though i think it would depend on the intensity distribution of each pixel in the image being uniform. You might end up turning all the letterbox bars to grey unless some fairly advanced heuristics were used. Perhaps I will try some further experiments sometime.

author: apelly
author_rank: Unknown
timestamp: September 05, 2016, 10:43:39 am
content: It may or may not be of use/interest to you, but there has been a bunch of code written for mythtv that identifies channel logos for the purpose of skipping advertisements automatically.I'll look for a link for you if you want.

author: mpicker21
author_rank: Contributor
timestamp: September 05, 2016, 01:45:06 pm
content: apelly beat me to it but yeah MythTV is a great open source project that does logo detection. It combines that with scene detection to get the actual edges of commercials as there is usually a slight delay for the logo to come in after the show resumes. They also use other techniques IIRC like CC detection to further improve accuracy.

author: bitslice
author_rank: Frequent Contributor
timestamp: September 05, 2016, 02:08:31 pm
content: This is one of the cleverest things I've seen for a while - to take a problem, find a loophole and present a fix which involves a considerable level of design skill. Much more laudable than the usual age-old Lego block solutions we can use to fix most problems.

author: jonovid
author_rank: Super Contributor
timestamp: September 05, 2016, 04:29:53 pm
content: Quoteyou may have a potential television advertising blocker or at least a way to detect television advertising and automatically lower the audio level.a potential new television design feature,the Ad kill ButtonSo keep working on this one, somebody may want it!But not problem here, I stopped watching broadcast television Years ago, IMO television is just a HD Video Monitor for Gaming or YouTube.