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
How it works
- The image is read an converted to B/W to execute operations upon
- 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) = 0which implies that the edge is perfectly horizonatal. Credits to a SO answer here
- 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
- 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.
- Having gotten the text now, we simply apply Binary Thresholding to obtain the mask for Inpainting the text.
- 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.42to attempt and restore the original color of the image.
- 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.
- The final image with a removed caption is obtained.