我用Python学习openCV库。我只想从这张图片中提取车牌:
我进行了一些处理,但是我不知道如何仅选择车牌。我曾尝试过级联,但它不起作用。
This is the code that I have:
# Standard imports
import cv2
import numpy as np
# Read image
img = cv2.imread("slika3.jpg",1)
#cv2.imshow('original',img)
#cv2.waitKey(0)
# covert image to gray
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow('gray',gray)
cv2.waitKey(0)
# apply bilateralFilter for smoothing the image
gray = cv2.bilateralFilter(gray,15,17,17)
cv2.imshow('blured gray',gray)
cv2.waitKey(0)
# processing image to blackhat
kernel = np.ones((7,7),np.uint8)
blackhat = cv2.morphologyEx(gray,cv2.MORPH_BLACKHAT,kernel)
cv2.imshow('blackhat',blackhat)
cv2.waitKey(0)
#What next?
这是最终图像。您会看到板上的数字和字母非常清楚,但是我不知道如何选择/提取它们: