Git Product home page Git Product logo

capsnap's Introduction

CapSnap

CapSnap is a tool to remove captions off Snapchat images and restore the original image.

Work still in progress.

Comparision of Original and Corrected Image

image

How it works

  1. The image is read an converted to B/W to execute operations upon
  2. We then find the black bars of the caption to be replaced using Hough Line Transform. We check the conditions where the line returned by this transform has cos(theta) = 0 which implies that the edge is perfectly horizonatal. Credits to a SO answer here
  3. After we have the black caption bar, we simply extract that part out from the image to work upon. This reduces the load on the algorithms
  4. This caption bar has Contrast Enhancement applied on it so that the text comes out upfront and should be easy to inpaint. We use the principle that every pixel can be transformed as X = aY + b where a and b are scalars and control the contrast and brightness. Have a look at the reference article on SO here.
  5. Having gotten the text now, we simply apply Binary Thresholding to obtain the mask for Inpainting the text.
  6. After inpainting the text, we have tried and reconstructed that part of the image hidden away behind the text. Now, we multiply every pixel value in this black caption bar by a constant 2.52/2.42 to attempt and restore the original color of the image.
  7. Having done this, we finally inpaint over the edges of the image obtained after recoloring the image. This should ensure a smooth and uniform image as the output.
  8. The final image with a removed caption is obtained.

Steps described are shown below

image

Usage

Dependencies: cv, numpy, matplotlib, argparse

To run: python capsnap.py --img /pathtoimage/imagename.format

capsnap's People

Contributors

bholagabbar avatar gonzalo933 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.