Image processing is new for me, so forgive me if my question sounds vague.

I'll try to supplement it with what I have learned until now and also a couple of images.

See the caption in the image below?

captioned image of guitar

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 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 inpaiting)
  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


1 Answer 1


Does this algorithm even make sense.

Your caption box is actually pretty wide – the algorithm that you've linked to would need to replace the complete content by its neighboring pixels. That won't look right – it will look as if someone "stretched" the guitar there.

So if you ask me, no, this is not the right approach here.

Now what I noticed is that the caption is not fully opaque.

I was confused for a while until I realized that with "caption" you mean the box, and I mean the text. So I'll refer to the box to avoid further confusion.

So, yes, that would be what I'd look at here. The image just seems to be darkened in the box area – what about you just take this part of the image, and reverse that darkening, by increasing the brightness? I'd assume that degree of darkening is static – so a bit of trying out in e.g. GIMP you should be able to figure this out; I tried this, and got this:


as you can see, it's slightly blueish- although the brightness seems to match. That might either be because whatever draws the box isn't actually reducing the brightness only, but somehow also changes the hue of the image in the region, but it might very well also be an artifact of JPEG compression; notice that your picture has a terrible quality to begin with. Or this is a color space conversion effect.

  • $\begingroup$ Hi thanks for the effort. I was watching this video on youtube youtube.com/watch?v=eYLID-ZAg7c which shows how to remove this caption via photoshop. Is this possible to achieve via code? $\endgroup$
    – gabbar0x
    Aug 20, 2016 at 18:18
  • $\begingroup$ I experimented with the brightening effect. Is there anyway we can get rid of the hue? The hue adjustment in photoshop didn't have any matching values that went with the surroundings $\endgroup$
    – gabbar0x
    Aug 20, 2016 at 18:28
  • $\begingroup$ as said, figure out where the hue comes from, find a correcting method in opencv. You'll need more than one picture to experiment on. $\endgroup$ Aug 20, 2016 at 18:30
  • $\begingroup$ Ok I have one more issue I worked on. It seems that when I completely brighten the caption box on a white background, there is still some opacity or grayness left. What effect could I use to overcome that? Maybe that is the key? Have a look at this: i.imgur.com/x3LB0OM.png $\endgroup$
    – gabbar0x
    Aug 20, 2016 at 18:34
  • $\begingroup$ That's probably an effect of anti-aliasing at the box border and JPEG compression. Again, you need to make screenshots that are less terribly compressed. $\endgroup$ Aug 20, 2016 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.