https://github.com/feramhq/Perspec Skip to content Sign up * Why GitHub? + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} feramhq / Perspec Public * Notifications * Fork 13 * Star 138 * Scriptable desktop app to correct the perspective of images feram.gumroad.com/l/perspec AGPL-3.0 License 138 stars 13 forks Star Notifications * Code * Issues 16 * Pull requests 0 * Actions * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 3 branches 4 tags Code Latest commit @ad-si ad-si Feat: Replace solid selection polygon with grid lines ... 307acec Jan 10, 2022 Feat: Replace solid selection polygon with grid lines 307acec Git stats * 103 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows CI: Fix move command Jan 10, 2022 app-aux-files Docs: Display better usage information when opening the macOS app Dec 31, 2021 app Fix: Renaming without an explicit first page number Dec 31, 2021 images Feat: Replace solid selection polygon with grid lines Jan 10, 2022 source Feat: Replace solid selection polygon with grid lines Jan 10, 2022 test Test: Add pending test for automatic rotation of PNGs Jan 10, 2022 .desktop CI: Fix icon path Jan 10, 2022 .gitignore Feat: Build Linux AppImage during CI Jan 10, 2022 Setup.hs Initial commit Jul 14, 2018 changelog.md Bump version to 0.2.0.0 Jan 2, 2022 development.md Feat: Replace solid selection polygon with grid lines Jan 10, 2022 license Change license to AGPL-3.0-or-later Feb 23, 2020 makefile Feat: Build Linux AppImage during CI Jan 10, 2022 package.yaml Chore: Update gloss-juicy and use its integrated EXIF reader Jan 8, 2022 readme.md Feat: Replace solid selection polygon with grid lines Jan 10, 2022 stack.yaml Feat: Build Linux AppImage during CI Jan 10, 2022 stack.yaml.lock Chore: Update gloss-juicy and use its integrated EXIF reader Jan 8, 2022 usage.txt Feat: Support renaming of photos with descending page numbers Dec 31, 2021 View code [ ] Perspec App Workflow Installation Prebuilt From Source Usage via CLI Photo Digitization Workflow Additional Steps Features Algorithms Perspective Transformation Grayscale Conversion BW Conversion Interpolation of Missing Parts Technologies Related readme.md Icon Perspec App and workflow to perspectively correct images. For example whiteboards, document scans, or facades. * App Workflow * Installation + Prebuilt + From Source * Usage via CLI * Photo Digitization Workflow + Additional Steps * Features * Algorithms + Perspective Transformation + Grayscale Conversion + BW Conversion + Interpolation of Missing Parts * Technologies * Related App Workflow Step Description Result 1 Take photos Original image 2 Open Perspec app Opened Perspec App 3 Drop the images onto the window Dropped image 4 Mark the corners by clicking on them Marked corners 5 Click one of the save buttons (or [Enter]) Corrected image Installation WARNING: Perspec currently only works on macOS. Any help to make it work on Linux (Ticket) and Microsoft (Ticket) would be greatly appreciated! Prebuilt You can get this (and previous) versions from the releases page. The current nightly version can be downloaded from https://github.com /feramhq/Perspec/actions. However, it's necessary to fix the file permissions after download: chmod +x \ ./Perspec.app/Contents/MacOS/Perspec \ ./Perspec.app/Contents/Resources/{perspec,script,imagemagick/bin/convert} On macOS you can also install it via this Homebrew tap: brew install --cask ad-si/tap/perspec From Source Build it from source with Haskell's stack. Platypus, with command line tools enabled , is required to build from source. git clone https://github.com/feramhq/Perspec cd Perspec make install This copies the Perspec.app to your /Applications directory and makes the perspec command available on your path. You can then either drop images on the app window, or use it via the CLI like perspec fix image.jpeg Usage via CLI It's also possible to directly invoke Perspec via the CLI like so: /Applications/Perspec.app/Contents/Resources/perspec fix path/to/image.jpeg You can also pass several images and they will all be opened one after another. This is very useful for batch correcting a large set of images. Photo Digitization Workflow 1. Take photos 1. Use camera app which lets you lock rotation (e.g. OpenCamera ). Otherwise check out the guide below to fix rotation. 2. Use a sound activated camera to take photos simply by clicking your tongue or snipping your finger. E.g. with: + Pluto Trigger - Hardware device + Magic Lantern - 3rd party firmware for Canon + iSoundCam - Android app 2. Use perspec rename sub-command to fix order and names of scanned files. 3. Verify that + All pages were captured and have the correct filename + Images are sharp enough + Images have a high contrast + Images have correct orientation 4. For best image quality convert images optionally to a lossless format (e.g. png), apply rotations, and convert them to grayscale. Attention: Exclude the covers! mogrify -verbose -format png \ -auto-orient -colorspace gray photos/*.jpeg 5. Use Perspec to crop images perspec fix photos/*.png Additional Steps Improve colors with one of the following steps: 1. Normalize dynamic range: mogrify -verbose -normalize photos/*.png 1. Convert to black and white: #! /usr/bin/env bash find . -iname "*.png" | \ while read -r file do convert \ -verbose \ "$file" \ \( +clone -blur 0x60 -brightness-contrast 40 \) \ -compose minus \ -composite \ -negate \ -auto-threshold otsu \ "$(basename "$file" ".png")"-fixed.png done In order to rotate all photos to portrait mode you can use either mogrify -verbose -auto-orient -rotate "90>" photos/*.jpeg or mogrify -verbose -auto-orient -rotate "-90>" photos/*.jpeg Features * [*] Rescale image on viewport change * [*] Handle JPEG rotation * [*] Draw lines between corners to simplify guessing of clipped corners * [*] Bundle Imagemagick * [*] Better error if wrong file format is dropped (images/ error-message.jpg) * [*] Center Perspec window on screen * [*] Drag'n'Drop for corner markers * [*] "Submit" button * [*] "Convert to Grayscale" button * [ ] Add support for custom output size (e.g. A4) * [ ] Manual rotation buttons * [ ] Zoom view for corners * [ ] Label corner markers Algorithms Perspective Transformation Once the corners are marked, the correction is equivalent to: convert \ images/example.jpg \ -distort Perspective \ '8,35 0,0 27,73 0,66 90,72 63,66 67,10 63,0' \ -crop 63x66+0+0 \ images/example-fixed.jpg Grayscale Conversion Converts image to grayscale and normalizes the range of values afterwards. (Uses Imagemagick's -colorspace gray -normalize) BW Conversion Converts image to binary format with OTSU's method. (Uses Imagemagick's -auto-threshold OTSU -monochrome) Interpolation of Missing Parts Perspec automatically interpolates missing parts by using the closest pixel. (https://www.imagemagick.org/Usage/misc/#edge) Technologies * Core is written in Haskell * Perspective transformation are handled by ImageMagick * App bundle is created with Platypus Related Check out ad-si/awesome-scanning for an extensive list of related projects. About Scriptable desktop app to correct the perspective of images feram.gumroad.com/l/perspec Topics desktop-app imagemagick app workflow gui haskell image keystone perspective photo correction scanning gloss perspective-transformation macos-app scriptable Resources Readme License AGPL-3.0 License Stars 138 stars Watchers 3 watching Forks 13 forks Releases 4 Perspec 0.2.0.0 Latest Jan 2, 2022 + 3 releases Contributors 3 * @ad-si ad-si Adrian Sieber * @RayBB RayBB Raymond Berger * @lancelet lancelet Jonathan Merritt Languages * Haskell 94.2% * Makefile 2.6% * Shell 2.6% * HTML 0.6% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.