I want to get rid of the black border around inorder to enhance ocr prediction. How to eliminate it? this is my code so far.
image = cv2.imread(filename)
cv2.resize(image,(416,416))
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
img_lp = cv2.resize(gray, (333, 75))
#img_gray_lp = cv2.cvtColor(img_lp, cv2.COLOR_BGR2GRAY)
_, img_binary_lp = cv2.threshold(img_lp, 200, 255,
cv2.THRESH_BINARY+cv2.THRESH_OTSU)
img_binary_lp = cv2.erode(img_binary_lp, (3,3))
img_binary_lp = cv2.dilate(img_binary_lp, (3,3))
cv2.floodFill(img_binary_lp, None, (0,0), 255)
LP_WIDTH = img_binary_lp.shape[0]
LP_HEIGHT = img_binary_lp.shape[1]
# Make borders white
img_binary_lp[0:3,:] = 255
img_binary_lp[:,0:3] = 255
img_binary_lp[72:75,:] = 255
img_binary_lp[:,330:333] = 255
#Estimations of character contours sizes of cropped license plates
dimensions = [LP_WIDTH/6,
LP_WIDTH/2,
LP_HEIGHT/10,
2*LP_HEIGHT/3]
plt.imshow(img_binary_lp, cmap='gray')
if i tried flood fill it removes certain initial letters in certain images like