These scripts need python 2.7+ and the following libraries to work:
- pillow(~2.8.1)
- numpy(~1.9.0)
- python-opencv(~2.4.11)
The simplest way to install all of them is to install python(x,y).
If you can't install python(x,y), You can install python, numpy and python-opencv seperately, then install pip and pillow.
- Install python. Just use the installer from python's website
- Install numpy. Just use the installer from scipy's website. (You don't need scipy to run this project, so you can just install numpy alone).
- Install python-opencv. Download the release from its sourceforge site. (Choose the release based on your operating system, then choose version 2.4.11). The executable is just an archive. Extract the files, then copy
cv2.pyd
to thelib/site-packages
folder on your python installation path. - Install pip. Download the script for installing pip, open cmd (or termianl if you are using Linux/Mac OS X), go to the path where the downloaded script resides, and run
python get-pip.py
- Install pillow. Run
pip install pillow
.
If you are running the code under Linux/Mac OS X and the scripts throw AttributeError: __float__
, make sure your pillow has jpeg support (consult Pillow's document) e.g. try:
sudo apt-get install libjpeg-dev
sudo pip uninstall pillow
sudo pip install pillow
If you have any problem installing the dependencies, contact the author.
- To generate all results, enter the
src
directory, run
python main.py
It will use images under dataset
directory to produce the results. The results will show up in result
directory. Intermediate results will be saved too.
- To see how long the script will need to generate the results (without saving them or the intermediate images), run
python main.py -t
- To generate resized final results (by 1/3), run
python main.py -r
- To generate intermediate results, run
python main.py -i
Or if you want resized intermidate results:
python main.py -i -r
##Directory structure
.
├─ README.md
├─ doc (report and other documents)
│ └── ...
├─ dataset (source images)
│ └── ...
├─ result (the results)
│ └── ...
└─ src (the python source code)
├── perspective.py (perspective correction module)
└── main.py (generate the results for the report)
##About
- Github repository
- Author: Qiuyi Zhang
- Time: Apr. 2015