• Skip to content
  • Skip to menu

Spillerrec's den

Exploring image processing and mechanics 

Rss 2.0

  • Home
  • About
  • Favorites
  • Projects plan

Dec 22 2013

Logo detection and removal

Category: Overmix,Programs,Software — Spiller @ 20:36

One annoying artifact of averaging all frames is that static content such as TV channel logos will appear in the final image for each frame:

Artifact produced by the precence of TV channel logos

Similarly, sometimes frames contains a small black border which also ruins the image. My old way of thinking was that I should make a filter which ignored largely inconsistent pixels. But really, all we need to do is to crop the image…

It is the same deal with logos, what we want to do is to ignore the area which contains the logo. That means we have to select that area, which is pretty easy to do manually. But what about doing it automatically?

Logo detection, first attempt

The logo is positioned exactly the same place on each and every frame. The pixels at the logo thus have consistent values so the idea is that if we find the difference, any value below a certain threshold is part of the logo.

It doesn’t work that well, because the assumption that all other parts are inconsistent doesn’t always hold. Notice how in the above image the whole right side has about the same color. Furthermore, the logo isn’t always consistent as it is usually a bit transparent and changes depending on the background.

Below is an example of this method (top) and the final method (below). Notice how the logo looks dark, but the thresholded version to the right nearly did not capture any of the logo. While it is not very noticeable, the very right side is actually about as dark as the logo, so using any threshold higher than what was used, would include incorrect areas.

Comparision of logo-detection methods

Working logo detection

The idea with this method is that instead of trying to find consistency in the frames, we estimate the original image and tries to find the inconsistencies. The original image doesn’t contain the TV logo, so the inconsistency should be high where the logo is. Then for each frame, we find the difference between that frame and the expected image. To ignore inconsistencies such as compression artifacts and the like, we find the consistencies in all the frames differences. A graphical overview of this method is given below:

The logo detection algorithm overview

The old average method is actually a decent estimate for the original image. While the logo does appear, it is quite a bit dimmer than on the individual frames as it is averaged with frames where it does not appear at that spot. As seen in the “Static stitched difference” image, it works well. However it is far from perfect, as there are some bright areas right around the logo. That is the afterimage of the logos in the estimate, if we could come up with a better estimate, that would disappear.

But that is exactly what we can now, since if we ignore the area we just found, the image would appear without logos. While our estimate was good enough, see this example of a credits text we would like to detect and remove: (click on the image to see it in full size)

Logo-detection result when running it repeatably

The first detection (to the left) was far from good enough, but if we make a new estimation of the original image, based on that detection, we get closer to the truth and thus a better detection. We can continue iterating until the detection is stable.

Not quite automatic yet

The thresholds have been selected manually, but I do believe that it might be able to work nearly automatically. If instead of thresholding at the end of each detection instead keep it in gray-scale, we could use it as a probability for that pixel to be correct. The less likely the pixel is correct, the less it will affect the estimate in the presence of other pixels, hopefully resulting in an better estimate. It will most likely require more iterations to get a good estimate though and we might still have to do a final thresholding manually.

I could test it, I have just not yet invested the time needed to do so…

Further work

A few pixels in the mask are missing, which could affect the image negatively. Using dilation here might be a good idea.

In case some areas are completely covered by credits or the like in all frames, there exists algorithms to guess the missing pixels. Could be interesting to mess around with.

Also, it does not appear to currently correctly work on the chroma channels. In the credits example, it is still possible to slightly see the effect of the credits, but most of that is from the chroma channels. I’m not quite sure why the credits still affect the chroma channels, but I guess it is related to the subsampling. Probably nothing to major.

But I’m getting close to understanding how the image alignment issues appears, and I want to try to see if I can solve it first.

Tags: TV logo

Comments (0)



  • Recent Posts
    • CakeSpinner
    • Minimizing JPEG artifacts
    • Removing mosaic censor
    • Extracting an image overlay
    • 6×6 off-roader
  • Recent Comments
    • Jan on 6×6 off-roader
    • Spiller on 6×6 off-roader
    • Jan on 6×6 off-roader
    • Spiller on Linear 4-finger grabber
    • renanda tribowo on Linear 4-finger grabber
  • Archives
    • February 2017
    • August 2015
    • July 2015
    • May 2015
    • March 2015
    • February 2015
    • November 2014
    • March 2014
    • February 2014
    • January 2014
    • December 2013
    • November 2013
    • June 2013
    • February 2013
    • November 2012
    • July 2012
    • June 2012
    • May 2012
    • March 2012
    • February 2012
    • January 2012
    • November 2011
    • October 2011
    • September 2011
    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • February 2010
  • Categories
    • Anime
    • cgCompress
    • LDraw
    • Lego
    • Mindstorms
    • NXC
    • NXT RPG
    • Overmix
    • Programs
    • RICcreator
    • Software
    • Stepmania
    • Technics
    • Uncategorized
    • Webdevelopment
  • Meta
    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

top

Powered by WordPress and Stardust

Created by Tommaso Baldovino