This is my code for targeting text in python
def showfig(image, ucmap):
imgplot=plt.imshow(image, ucmap)
get_ipython().magic(u'matplotlib inline')
#L=img.shape[0]
#C=img.shape[1]
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import cv2
kernel=np.ones((15,10))
img = cv2.imread("texto.png",0)
plt.figure(figsize=(15,10))
showfig(img,"gray")
def limiar (img):
img_linear=img.copy()
_,img_linear = cv2.threshold(img,121,255,cv2.THRESH_BINARY_INV)
return img_linear
img = limiar(img)
plt.figure(figsize=(15,10))
showfig(img,"gray")
def dilatar (img,kernel,iDila):
img_dilation=img.copy()
img_dilation = cv2.dilate(img,kernel,iterations=iDila)
return (img_dilation)
img = dilatar(img,kernel,1)
plt.figure(figsize=(15,10))
showfig(img,"gray")
I need to separate letters, punctuations, words, paragraphs, and lines. How should I proceed, anyone know? By the array gave a strange value.