def extractOuterGrid(img):
rows,cols = np.shape(img)
maxArea = 0
point = [0,0]
imgOriginal = img.copy()
for i in range(rows):
for j in range(cols):
if img[i][j] == 255:
img,area,dummy = customFloodFill(img,[i,j],100,0)
if area > maxArea:
maxArea = area
point = [i,j]
img = imgOriginal
img,area,dummy = customFloodFill(img,[point[0],point[1]],100,0)
for i in range(rows):
for j in range(cols):
if img[i][j] == 100:
img[i][j] = 255
else: img[i][j] = 0
return img,point
# Draws a line on the image given its parameters in normal form
评论列表
文章目录