All Projects → sbrunner → Deskew

sbrunner / Deskew

Licence: mit
Library used to deskew a scanned document

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Deskew

Zmap
ZMap is a fast single packet network scanner designed for Internet-wide network surveys.
Stars: ✭ 4,083 (+4066.33%)
Mutual labels:  scanning
Sqliv
massive SQL injection vulnerability scanner
Stars: ✭ 840 (+757.14%)
Mutual labels:  scanning
Esp8266 deauther
Affordable WiFi hacking platform for testing and learning
Stars: ✭ 9,312 (+9402.04%)
Mutual labels:  scanning
Phoneinfoga
PhoneInfoga is one of the most advanced tools to scan international phone numbers using only free resources. It allows you to first gather standard information such as country, area, carrier and line type on any international phone number. Then search for footprints on search engines to try to find the VoIP provider or identify the owner.
Stars: ✭ 5,927 (+5947.96%)
Mutual labels:  scanning
Scantron
A distributed nmap / masscan scanning framework complete with an API client for automation workflows
Stars: ✭ 542 (+453.06%)
Mutual labels:  scanning
Scanless
online port scan scraper
Stars: ✭ 875 (+792.86%)
Mutual labels:  scanning
Celerystalk
An asynchronous enumeration & vulnerability scanner. Run all the tools on all the hosts.
Stars: ✭ 333 (+239.8%)
Mutual labels:  scanning
React Native Fingerprint Identify
Awesome Fingerprint Identify for react-native (android only)
Stars: ✭ 81 (-17.35%)
Mutual labels:  scanning
Openscap
NIST Certified SCAP 1.2 toolkit
Stars: ✭ 750 (+665.31%)
Mutual labels:  scanning
Burp Suite Error Message Checks
Burp Suite extension to passively scan for applications revealing server error messages
Stars: ✭ 45 (-54.08%)
Mutual labels:  scanning
Android Scanner Compat Library
A compat library for Bluetooth Low Energy scanning on Android.
Stars: ✭ 462 (+371.43%)
Mutual labels:  scanning
Multiscanner
Modular file scanning/analysis framework
Stars: ✭ 494 (+404.08%)
Mutual labels:  scanning
Burp Suite Software Version Checks
Burp extension to passively scan for applications revealing software version numbers
Stars: ✭ 29 (-70.41%)
Mutual labels:  scanning
Konan
Konan - Advanced Web Application Dir Scanner
Stars: ✭ 412 (+320.41%)
Mutual labels:  scanning
Sane Scan Pdf
Sane command-line scan-to-pdf script on Linux with OCR and deskew support
Stars: ✭ 58 (-40.82%)
Mutual labels:  scanning
Rustscan
🤖 The Modern Port Scanner 🤖
Stars: ✭ 5,218 (+5224.49%)
Mutual labels:  scanning
Dracnmap
Dracnmap is an open source program which is using to exploit the network and gathering information with nmap help. Nmap command comes with lots of options that can make the utility more robust and difficult to follow for new users. Hence Dracnmap is designed to perform fast scaning with the utilizing script engine of nmap and nmap can perform various automatic scanning techniques with the advanced commands.
Stars: ✭ 861 (+778.57%)
Mutual labels:  scanning
Nmap Erpscan
Nmap custom probes for better detecting SAP services
Stars: ✭ 96 (-2.04%)
Mutual labels:  scanning
Rubocop Thread safety
Stars: ✭ 78 (-20.41%)
Mutual labels:  scanning
Nugetdefense
An MSBuildTask that checks for known vulnerabilities. Inspired by OWASP SafeNuGet.
Stars: ✭ 44 (-55.1%)
Mutual labels:  scanning

Deskew

//Note: Skew is measured in degrees. Deskewing is a process whereby skew is removed by rotating an image by the same amount as its skew but in the opposite direction. This results in a horizontally and vertically aligned image where the text runs across the page rather than at an angle.

Skew detection and correction in images containing text

Image with skew
Image after deskew

Cli usage

Get the skew angle:

deskew input.png

Deskew an image:

deskew --output output.png input.png

Lib usage

scikit-image:

import numpy as np
from skimage import io
from skimage.color import rgb2gray
from skimage.transform import rotate

from deskew import determine_skew

image = io.imread('input.png')
grayscale = rgb2gray(image)
angle = determine_skew(grayscale)
rotated = rotate(image, angle, resize=True) * 255
io.imsave('output.png', rotated.astype(np.uint8))

OpenCV:

import math
from typing import Tuple, Union

import cv2
import numpy as np

from deskew import determine_skew


def rotate(
        image: np.ndarray, angle: float, background: Union[int, Tuple[int, int, int]]
) -> np.ndarray:
    old_width, old_height = image.shape[:2]
    angle_radian = math.radians(angle)
    width = abs(np.sin(angle_radian) * old_height) + abs(np.cos(angle_radian) * old_width)
    height = abs(np.sin(angle_radian) * old_width) + abs(np.cos(angle_radian) * old_height)

    image_center = tuple(np.array(image.shape[1::-1]) / 2)
    rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
    rot_mat[1, 2] += (width - old_width) / 2
    rot_mat[0, 2] += (height - old_height) / 2
    return cv2.warpAffine(image, rot_mat, (int(round(height)), int(round(width))), borderValue=background)

image = cv2.imread('input.png')
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
angle = determine_skew(grayscale)
rotated = rotate(image, angle, (0, 0, 0))
cv2.imwrite('output.png', rotated)

Inspired by Alyn: https://github.com/kakul/Alyn

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].