Scanned Image Enhancement in Python
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 17:11:32 2020
This program is to show that how to enhance a scanned image
@author: AdilKhan
"""
import matplotlib.pyplot as plt
from skimage import data
from IPython import get_ipython
get_ipython().run_line_magic('matplotlib', 'qt')
directory = 'C:/Users/AdilKhan/Desktop/Scanner/' #directory address
imageName = 'input.jpg' # image name
inputFile = directory + imageName #image path
page = data.load(inputFile) #load image
plt.subplot(1,3,1)
plt.title('Original Image')
plt.imshow(page)
threashold = 180 # set threashold
mask = page > threashold # create mask
#textColor = [69,130,222] #text color blue
textColor = 0
scanned = page
scanned[:] = textColor
scanned[mask] = 255
plt.subplot(1,3,2)
plt.title('Scanned Image')
plt.imshow(scanned)
plt.imsave(directory + 'output.jpg',scanned)
cropped = scanned[60:2850,150:2150,:] #crop image
plt.subplot(1,3,3)
plt.title('Cropped Image')
plt.imshow(cropped)
plt.imsave(directory + 'cropped.jpg',cropped)
Image Enhancement with Python using skimage Library in python _ 0.zip
Download: Image Enhancement with Python using skimage Library in python _ 0.zip
Direct Current (DC) circuit breaker is an important element for the stable operation of DC...
we depict an experiment to the face recognition problem by combining eigenfaces and neural...
Delivery logistics is one of the most emerging industries in the world, worth over 70 bill...
A non-touch system is a modern approach to computer-interface technology that will re...