This sample image:


is warped on the left side.

I don't want to dewarp, but just to remove shadow gradient (caused by book's spine). I guess gradient can be calculated from upper part of the image and that information can be used for reconstruction.

First I thought to apply some layer transformation in Photoshop. I took upper part with clear gradient and scaled it vertically to cover whole image in new layer. Then I did layer difference:


but while upper part is acceptably reconstructed, colored part is not.

Does anyone have an idea how to approach this in Photoshop, or Python/SciPy/OpenCV, or Matlab?

  • 2
    $\begingroup$ try applying a saturation filter with same mask in photoshop $\endgroup$ – geometrikal Mar 6 '13 at 9:12
  • 1
    $\begingroup$ Hi geometrikal ;) Can you post it as answer and paste result screenshot? Thanks $\endgroup$ – zetah Mar 6 '13 at 10:55

The simplest approach would be to divide the gradient rather than subtract it. Here's what the result looks like:

Gradient Removal

  • $\begingroup$ This is really cool! How did you extract the gradient? $\endgroup$ – Phonon Mar 9 '13 at 5:42
  • $\begingroup$ Oh, same way as the OP did (I think). Took the top section and scaled it vertically. $\endgroup$ – datageist Mar 9 '13 at 5:44
  • $\begingroup$ Cool, I suspected so. = ) $\endgroup$ – Phonon Mar 9 '13 at 5:47
  • $\begingroup$ Thanks, it works great. From the layer operation blend naming, I assume you use Gimp ;) $\endgroup$ – zetah Mar 9 '13 at 11:57
  • $\begingroup$ I actually used PS (CS6), but was thinking more about math than blend modes :) $\endgroup$ – datageist Mar 9 '13 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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