<p>Alright so I'm a complete n00b at image processing so forgive me if my question sounds vague. I'll try to supplement it with what I have learnt until now and also a couple of images.</p>

<p>See the caption in the image below?</p>

<p><a href="https://i.sstatic.net/WC1qE.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WC1qE.jpg" alt="enter image description here"></a></p>

<p><strong>What I'm essentially trying to do, it to remove it and restore the original image in (Python using OpenCV).</strong></p>

<p>Now I have a couple of approaches in mind. First one I read about is a technique called <em>Inpainting</em>. Now I saw a tutorial on inpaiting <a href="http://docs.opencv.org/trunk/df/d3d/tutorial_py_inpainting.html" rel="nofollow noreferrer">here</a> but this required me to create a separate mask where the non-zero pixels denote the stuff I want gone.</p>

<p>Now what I noticed is that the caption is not fully opaque. So i was wondering if there is any possible way to restore the original image by first removing the darkened part of the strip. (essentially something very the original image with only the whitened text on it) and then create a mask of the text and then use inpaiting.</p>

<p>Now I have a couple of questions. </p>

<ol>
<li>What technique do I use to remove the darkened part (let the text be now, we can remove it in the second step using inpainting)</li>
<li>Does this algorithm even make sense. Is there a better approach I should be looking at?</li>
</ol>

<p>NOTE: In no way am I looking for any sort of code or specific implementation. I'm just looking for what <em>techniques</em> and <em>procedures</em> I can study up on so as to get the job done. The rest is on me</p>

CC BY-SA 3.0
2016-08-20T14:54:45.953Z
I think the Signal Processing SE (http://dsp.stackexchange.com/) would be more suited for this type of question.
Julien Guertault
CC BY-SA 3.0
2016-08-20T17:17:36.523Z
I like your idea of reversing the darkened band so the inpainting only needs to be applied to the text and small face. The darkening is likely to be a fairly simple function such as halving the colour values of each pixel. You could experiment with different values to see if there's an obvious fit.
trichoplax is on Codidact now
CC BY-SA 3.0
2016-08-20T17:18:26.420Z
Bear in mind that the darkening may have been applied to linear or gamma corrected pixel values, so that's another thing to experiment with.
trichoplax is on Codidact now
CC BY-SA 3.0
2016-08-20T17:22:44.603Z
@trichoplax Thanks! Alright I'll try that then. Also, is there any way to reach you by email? I'd love some guidance and I can't find anyone
gabbar0x
CC BY-SA 3.0
2016-08-20T17:30:37.880Z
There was an [inpainting programming competition](http://codegolf.stackexchange.com/questions/70483/patch-the-image) over on Programming Puzzles and Code Golf Stack Exchange, which may give you some inspiration and different approaches to try. The top approach is quite in depth, and there are also a number of different simpler ideas lower down.
trichoplax is on Codidact now
CC BY-SA 3.0
2016-08-20T17:32:07.867Z
If you start work on your own approach and run into a problem, you can ask another question here, explaining what you have tried so far. If you have any doubts over what you can ask about, you can contact me in [chat] using @trichoplax
trichoplax is on Codidact now
CC BY-SA 3.0
2016-08-20T17:33:42.150Z
@tricoplax: but I should go for the impainting approach only after I've gotten rid of the darkened strips yes?
gabbar0x
CC BY-SA 3.0
2016-08-22T18:12:12.430Z
Is this your original image? Or did you just dump a jpeg compression on it?
joojaa
CC BY-SA 3.0
2016-08-22T18:29:49.930Z
@trichoplax it is a simple function. If it were for the horrible compression artifacts in he image Id have deleted the line by now, [here is the test](https://i.sstatic.net/cDE1A.png) again i wouldn't bother to do this with these kinds of jepg qualities. The color cast could be easily deleted if the jpeg artifacts wouldn't have ruined the area.
joojaa
CC BY-SA 3.0
2016-08-22T21:59:17.777Z
@jooja Actually the original image is of better quality. This one o downloaded off facebook so its compressed. How exactly did you transform the image? I mean remove the darkened part? What's the function?
gabbar0x
CC BY-SA 3.0
2016-08-23T19:17:57.980Z
@joojaa What was the technique you used to remove the darkened pixels?
gabbar0x
<image-processing><filtering>
Removing a darkened caption with text on it in an image
gabbar0x
# Removing a darkened caption with text on it in an image

(Asked by: username_0 on 2016-08-20)

Alright so I'm a complete n00b at image processing so forgive me if my question sounds vague. I'll try to supplement it with what I have learnt until now and also a couple of images.

See the caption in the image below?

[![enter image description here](https://i.sstatic.net/WC1qE.jpg)](https://i.sstatic.net/WC1qE.jpg)

**What I'm essentially trying to do, it to remove it and restore the original image in (Python using OpenCV).**

Now I have a couple of approaches in mind. First one I read about is a technique called *Inpainting*. Now I saw a tutorial on inpaiting [here](http://docs.opencv.org/trunk/df/d3d/tutorial_py_inpainting.html) but this required me to create a separate mask where the non-zero pixels denote the stuff I want gone.

Now what I noticed is that the caption is not fully opaque. So i was wondering if there is any possible way to restore the original image by first removing the darkened part of the strip. (essentially something very the original image with only the whitened text on it) and then create a mask of the text and then use inpaiting.

Now I have a couple of questions.

1. What technique do I use to remove the darkened part (let the text be now, we can remove it in the second step using inpainting)
2. Does this algorithm even make sense. Is there a better approach I should be looking at?

NOTE: In no way am I looking for any sort of code or specific implementation. I'm just looking for what *techniques* and *procedures* I can study up on so as to get the job done. The rest is on me

**Tags:** image-processing, filtering

> **Comments:**
> **username_1**: I think the Signal Processing SE (http://dsp.stackexchange.com/) would be more suited for this type of question.  
> **username_2**: I like your idea of reversing the darkened band so the inpainting only needs to be applied to the text and small face. The darkening is likely to be a fairly simple function such as halving the colour values of each pixel. You could experiment with different values to see if there's an obvious fit.  
> **username_2**: Bear in mind that the darkening may have been applied to linear or gamma corrected pixel values, so that's another thing to experiment with.  
> **username_0**: @username_2 Thanks! Alright I'll try that then. Also, is there any way to reach you by email? I'd love some guidance and I can't find anyone  
> **username_2**: There was an [inpainting programming competition](http://codegolf.stackexchange.com/questions/70483/patch-the-image) over on Programming Puzzles and Code Golf Stack Exchange, which may give you some inspiration and different approaches to try. The top approach is quite in depth, and there are also a number of different simpler ideas lower down.  
> **username_2**: If you start work on your own approach and run into a problem, you can ask another question here, explaining what you have tried so far. If you have any doubts over what you can ask about, you can contact me in [chat] using @username_2  
> **username_0**: @tricoplax: but I should go for the impainting approach only after I've gotten rid of the darkened strips yes?  
> **username_3**: Is this your original image? Or did you just dump a jpeg compression on it?  
> **username_3**: @username_2 it is a simple function. If it were for the horrible compression artifacts in he image Id have deleted the line by now, [here is the test](https://i.sstatic.net/cDE1A.png) again i wouldn't bother to do this with these kinds of jepg qualities. The color cast could be easily deleted if the jpeg artifacts wouldn't have ruined the area.  
> **username_0**: @jooja Actually the original image is of better quality. This one o downloaded off facebook so its compressed. How exactly did you transform the image? I mean remove the darkened part? What's the function?  
> **username_0**: @username_3 What was the technique you used to remove the darkened pixels?  

---

## 0 answers

