Skip to content

An image "scanning" app written in Python using OpenCV, an improvement of my Image scanner, a standalone app that takes an photo of a paper, and outputs an edited image with the paper properly aligned as though it was scanned.

License

Notifications You must be signed in to change notification settings

ElenaChes/Python-Image-scanner-Standalone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image scanner - Standalone

An image "scanning" app written in Python using OpenCV.
Description: an improvement of my Image scanner, a standalone app that takes an photo of a paper, and outputs an edited image with the paper properly aligned as though it was scanned.

Content



image.jpg ⇨ image_scanned.png

Dependencies

  1. Python 3.7.0

The app could work with different versions, but this is the one that was tested.

Installation

Using the executable

  1. Download Image Scanner.zip and extract its contents into a folder.

Tip

Create a shortcut for Image Scanner/Image Scanner.exe outside the folder to easily access the app.

Running the raw code

  1. Create a new directory, for example scanner, and place imageScanner.py and scanner.ico inside of it.
  2. Open the directory in your Terminal:
cd scanner
  1. Create a virtual environment:
python -m venv opencv-env
  1. Activate the environment :
.\opencv-env\Scripts\activate
  1. Install needed packages:
pip install opencv-contrib-python matplotlib

Creating an executable from the code

To create Image Scanner/Image Scanner.exe the following command was used:

pyinstaller --onedir --icon=scanner.ico --add-data="scanner.ico;." --windowed --name="Image Scanner" imageScanner.py

While scanner.ico is the icon used for the app.

If you don't want to use an icon you can remove the following line from imageScanner.py:

root.iconbitmap("scanner.ico")

And create an executable using:

pyinstaller --onedir --windowed --name="Image Scanner" imageScanner.py

Usage

  1. Run Image Scanner/Image Scanner.exe (or imageScanner.py).
  2. Choose an image to edit.
  3. Choose a location to export the new image to and name it.

Note

Common causes for failing to process the image:

  • The paper isn't visible in its entirety in the input image.
  • The paper and the background color aren't distinct enough in the input image.

About

An image "scanning" app written in Python using OpenCV, an improvement of my Image scanner, a standalone app that takes an photo of a paper, and outputs an edited image with the paper properly aligned as though it was scanned.

Topics

Resources

License

Stars

Watchers

Forks

Languages