Ask Your Question

Revision history [back]

Tesseract ocr failed to recognize number from number plate images

import cv2 import numpy as np from PIL import Image import pytesseract from scipy import ndimage from scipy.ndimage import rotate

from matplotlib import pyplot as plt

import allow_needed_values as anv

img = cv2.imread('path_to_image/1.jpg') result = cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21) cv2.imshow("denoise",result) gray = cv2.cvtColor(result, cv2.COLOR_RGB2GRAY) cv2.imshow("gray image",gray)

gray = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1] cv2.imshow("threshold image", gray)

cv2.waitKey(delay = 0)

gray = cv2.medianBlur(gray, 3)

img = cv2.medianBlur(gray,3) cv2.imshow("median blur", img)

rot = rotate(img, -6, reshape=False)

rotated= ndimage.rotate(img,-2)

cv2.imshow("rotate image", rot)

result = cv2.fastNlMeansDenoisingColored(img,None,20,10,7,21)

rot = rotate(img, -5, reshape=False) cv2.imshow("rotate", rot) tessdata_dir_config = "/usr/share/tesseract-ocr/4.00/tessdata/" text=pytesseract.image_to_string(rot,lang='eng',config=tessdata_dir_config) carReg = anv.catch_rectify_plate_characters(text) print(carReg) cv2.waitKey(delay = 0)

Here i write the code for number recognition from number plate images,but the tessaract failed to recognize number. I have day light and night images. in most of the case ocr failed on night images. also i apply various filter filter for images clearing and also rotate the image angle for some degree.

I upload the various sample images where tesseract ocr failed. ![test images where ocr failedimage description(/upfiles/15717353235295011.jpeg)image description(/upfiles/1571735416748195.jpg)(/upfiles/15717353985235123.jpg)(/upfiles/15717353738035894.jpeg)

Tesseract ocr failed to recognize number from number plate images

Code:

import cv2
import numpy as np
from PIL import Image
import pytesseract
from scipy import ndimage
from scipy.ndimage import rotate

from rotate #from matplotlib import pyplot as plt

plt import allow_needed_values as anv

anv img = cv2.imread('path_to_image/1.jpg') result = cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21) cv2.imshow("denoise",result) gray = cv2.cvtColor(result, cv2.COLOR_RGB2GRAY) cv2.imshow("gray image",gray)

image",gray) gray = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1] cv2.imshow("threshold image", gray)

cv2.waitKey(delay = 0)

gray gray) #cv2.waitKey(delay = 0) #gray = cv2.medianBlur(gray, 3)

3) img = cv2.medianBlur(gray,3) cv2.imshow("median blur", img)

rot img) #rot = rotate(img, -6, reshape=False)

rotated= ndimage.rotate(img,-2)

cv2.imshow("rotate reshape=False) #rotated= ndimage.rotate(img,-2) #cv2.imshow("rotate image", rot)

result = cv2.fastNlMeansDenoisingColored(img,None,20,10,7,21)

rot) #result = cv2.fastNlMeansDenoisingColored(img,None,20,10,7,21) rot = rotate(img, -5, reshape=False) cv2.imshow("rotate", rot) tessdata_dir_config = "/usr/share/tesseract-ocr/4.00/tessdata/" text=pytesseract.image_to_string(rot,lang='eng',config=tessdata_dir_config) carReg = anv.catch_rectify_plate_characters(text) print(carReg) cv2.waitKey(delay = 0)

0)

Here i write the code for number recognition from number plate images,but the tessaract failed to recognize number. I have day light and night images. in most of the case ocr failed on night images. also i apply various filter filter for images clearing and also rotate the image angle for some degree.

I upload the various sample images where tesseract ocr failed. ![test images where ocr failedimage description(/upfiles/15717353235295011.jpeg)image description(/upfiles/1571735416748195.jpg)(/upfiles/15717353985235123.jpg)(/upfiles/15717353738035894.jpeg)

Tesseract ocr failed to recognize number from number plate images

Code:

import cv2
import numpy as np
from PIL import Image
import pytesseract
from scipy import ndimage
from scipy.ndimage import rotate
#from matplotlib import pyplot as plt

import allow_needed_values as anv

img = cv2.imread('path_to_image/1.jpg')
result = cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21)
cv2.imshow("denoise",result)
gray = cv2.cvtColor(result, cv2.COLOR_RGB2GRAY)
cv2.imshow("gray image",gray)

gray = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
cv2.imshow("threshold image", gray)
#cv2.waitKey(delay = 0)
#gray = cv2.medianBlur(gray, 3)
img = cv2.medianBlur(gray,3)
cv2.imshow("median blur", img)
#rot = rotate(img, -6, reshape=False)
#rotated= ndimage.rotate(img,-2)
#cv2.imshow("rotate image", rot)
#result = cv2.fastNlMeansDenoisingColored(img,None,20,10,7,21)
rot = rotate(img, -5, reshape=False)
cv2.imshow("rotate", rot)
tessdata_dir_config = "/usr/share/tesseract-ocr/4.00/tessdata/"
text=pytesseract.image_to_string(rot,lang='eng',config=tessdata_dir_config)
carReg = anv.catch_rectify_plate_characters(text)
print(carReg)
cv2.waitKey(delay = 0)

Here i write the code for number recognition from number plate images,but the tessaract failed to recognize number. I have day light and night images. in most of the case ocr failed on night images. also i apply various filter filter for images clearing and also rotate the image angle for some degree.

I upload the various sample images where tesseract ocr failed. ![test images where ocr failedimage description(/upfiles/15717353235295011.jpeg)failed. image description image description image description(/upfiles/1571735416748195.jpg)(/upfiles/15717353985235123.jpg)(/upfiles/15717353738035894.jpeg) image description image description image description

Tesseract ocr failed to recognize number from number plate images

Code:

import cv2
import numpy as np
from PIL import Image
import pytesseract
from scipy import ndimage
from scipy.ndimage import rotate
#from matplotlib import pyplot as plt

import allow_needed_values as anv

img = cv2.imread('path_to_image/1.jpg')
result = cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21)
cv2.imshow("denoise",result)
gray = cv2.cvtColor(result, cv2.COLOR_RGB2GRAY)
cv2.imshow("gray image",gray)

gray = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
cv2.imshow("threshold image", gray)
#cv2.waitKey(delay = 0)
#gray = cv2.medianBlur(gray, 3)
img = cv2.medianBlur(gray,3)
cv2.imshow("median blur", img)
#rot = rotate(img, -6, reshape=False)
#rotated= ndimage.rotate(img,-2)
#cv2.imshow("rotate image", rot)
#result = cv2.fastNlMeansDenoisingColored(img,None,20,10,7,21)
rot = rotate(img, -5, reshape=False)
cv2.imshow("rotate", rot)
tessdata_dir_config = "/usr/share/tesseract-ocr/4.00/tessdata/"
text=pytesseract.image_to_string(rot,lang='eng',config=tessdata_dir_config)
carReg = anv.catch_rectify_plate_characters(text)
print(carReg)
cv2.waitKey(delay = 0)

Here i write the code for number recognition from number plate images,but the tessaract failed to recognize number. I have day light and night images. in most of the case ocr failed on night images. also i apply various filter filter for images clearing and also rotate the image angle for some degree.

I upload the various sample images where tesseract ocr failed. ![test images where ocr failed. image description image description image description image description image description image description

Tesseract ocr failed to recognize number from number plate images

Code:

import cv2
import numpy as np
from PIL import Image
import pytesseract
from scipy import ndimage
from scipy.ndimage import rotate
#from matplotlib import pyplot as plt

import allow_needed_values as anv

img = cv2.imread('path_to_image/1.jpg')
result = cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21)
cv2.imshow("denoise",result)
gray = cv2.cvtColor(result, cv2.COLOR_RGB2GRAY)
cv2.imshow("gray image",gray)

gray = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
cv2.imshow("threshold image", gray)
#cv2.waitKey(delay = 0)
#gray = cv2.medianBlur(gray, 3)
img = cv2.medianBlur(gray,3)
cv2.imshow("median blur", img)
#rot = rotate(img, -6, reshape=False)
#rotated= ndimage.rotate(img,-2)
#cv2.imshow("rotate image", rot)
#result = cv2.fastNlMeansDenoisingColored(img,None,20,10,7,21)
rot = rotate(img, -5, reshape=False)
cv2.imshow("rotate", rot)
tessdata_dir_config = "/usr/share/tesseract-ocr/4.00/tessdata/"
text=pytesseract.image_to_string(rot,lang='eng',config=tessdata_dir_config)
carReg = anv.catch_rectify_plate_characters(text)
print(carReg)
cv2.waitKey(delay = 0)

Here i write the code for number recognition from number plate images,but the tessaract failed to recognize number. I have day light and night images. in most of the case ocr failed on night images. also i apply various filter filter for images clearing and also rotate the image angle for some degree.

I upload the various sample images where tesseract ocr failed. image description image description image description image description image description image description