diff --git a/alyn/__init__.py b/alyn/__init__.py index 1b430f8..adc9191 100644 --- a/alyn/__init__.py +++ b/alyn/__init__.py @@ -1,3 +1,3 @@ """ Import required modules""" -from deskew import * -from skew_detect import * +from .deskew import * +from .skew_detect import * \ No newline at end of file diff --git a/alyn/deskew.py b/alyn/deskew.py index 029be4f..605b601 100755 --- a/alyn/deskew.py +++ b/alyn/deskew.py @@ -3,7 +3,7 @@ import numpy as np import matplotlib.pyplot as plt -from skew_detect import SkewDetect +from .skew_detect import SkewDetect from skimage import io from skimage.transform import rotate diff --git a/alyn/skew_detect.py b/alyn/skew_detect.py index 2612102..1d0639d 100755 --- a/alyn/skew_detect.py +++ b/alyn/skew_detect.py @@ -77,7 +77,7 @@ def compare_sum(self, value): def display(self, data): for i in data: - print i + ": " + str(data[i]) + print(i + ": " + str(data[i])) def calculate_deviation(self, angle): @@ -104,7 +104,7 @@ def run(self): if self.batch_path: self.batch_process() else: - print "Invalid input, nothing to process." + print("Invalid input, nothing to process.") else: self.process_single_file() @@ -156,7 +156,7 @@ def batch_process(self): def determine_skew(self, img_file): - img = io.imread(img_file, as_grey=True) + img = io.imread(img_file, as_gray=True) edges = canny(img, sigma=self.sigma) h, a, d = hough_line(edges) _, ap, _ = hough_line_peaks(h, a, d, num_peaks=self.num_peaks) diff --git a/readme.md b/readme.md index 90e8d2a..c3133ea 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,8 @@ [![PyPI version](https://badge.fury.io/py/alyn.svg)](https://badge.fury.io/py/alyn) +Note: Minor tweaks done to work with Python 3 + ## Skew detection and correction in images containing text