Skip to content

Latest commit

 

History

History
88 lines (74 loc) · 5 KB

README.md

File metadata and controls

88 lines (74 loc) · 5 KB

Content-Aware-Rotation

  • Reproduction of Kaiming He's Paper Content-Aware Rotation on ICCV 2013.
  • I just test this project on Windows 10, there may be something wrong on Linux system.

Contents

  1. Dependency
  2. Formula Derivation
  3. Usage
  4. Results
  5. References

Dependency

 Python 3.6 or newer
 pillow == 5.1.0
 numpy == 1.14.5
 opencv == 4.2.0
 matplotlib == 2.2.2
 tensorflow == 1.10.0

Formula Derivation

  • Rotation Manipulation
    eq2
    suppose that :
    eq3,
    then we have :
    eq4
    further, we can get the derivative :
    eq5

  • Line Preservation
    eq7
    suppose that :
    eq8,
    then we have :
    eq9
    further, we can get the derivative :
    eq10

  • Shape Preservation
    eq12
    suppose that :
    eq13,
    then we have :
    eq14
    further, we can get the derivative :
    eq15

  • Boundary Preservation
    eq17
    further, we can get the derivative :
    eq18

  • Optimization

  • Step 1 : Fix θ solve for V
    Sparse Linear System :
    eq19
    V is the minimum point of total energy above, thus, let :
    eq20
    we can get the solution for V.

  • Step 2 : Fix V solve for θ
    Part 1 : Fix Φ, update θ
    eq21
    suppose that :
    eq22
    we have :
    eq23
    then let :
    eq24
    by solving a sparse linear system, we can get the solution of θ :
    eq25
    Part 2 : Fix θ, update Φ
    eq26
    the solution of Φ can be easily approximately reached by enumeration based on iteration methods(increase β gradually).

Usage

  • How to Use : download the whole project and run main.py
  • folder ep : images which are used for formula derivation and some results.
  • folder image : images which are used in original paper.
  • folder lsd : line segment detection algorithm in python version.
  • warp_mesh.py : image warping method realized by embedded function in tensorflow.

Results

References

Author : Kaiming He, Huiwen Chang, Jian Sun
Matlab Version