So, I'm generating a binary (well, really gray scale, 8bit, used as binary) image with python and opencv2, writing a small number of polygons to the image, and then dilating the image using a kernel. However, my source and destination image always end up the same, no matter what kernel I use. Any thoughts?
from matplotlib import pyplot import numpy as np import cv2 binary_image = np.zeros(image.shape,dtype='int8') for rect in list_of_rectangles: cv2.fillConvexPoly(binary_image, np.array(rect), 255) kernel = np.ones((11,11),'int') dilated = cv2.dilate(binary_image,kernel) if np.array_equal(dilated, binary_image): print("EPIC FAIL!!") else: print("eureka!!")
All I get is